Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > VB.NET > Third Party Products

Third Party Products Discussion on third party components for VB.NET

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-26-2008, 10:10 PM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Nov 2008
Posts: 2
Reputation: 0
Renee08 is on a distinguished programming path ahead
Default Opening a dotx file as read only

Currently I am creating a new Word document within the vb.net code and using AttachedTemplate to indicate what template the document should be based on.

It's possible for more than one person to be doing this at once, but the second person to run this code gets the "Locked for editing" dialog with the option of opening the template as Read only etc.

What I want to do is set the template to open/be attached as a read-only version (i.e. the equivalent of clicking "ok" to the Read only option). Is this possible?

A small sample of the code:

myWordDoc = myWordApp.Documents.Open(fullName, False, False, False)
myWordDoc .AttachedTemplate = strTemplateFilename

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-30-2008, 3:53 PM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Nov 2008
Posts: 2
Reputation: 0
Renee08 is on a distinguished programming path ahead
Default

With a bit of help I've found an answer:

If IO.Path.GetExtension(strTemplateFilename) = ".dotx" Or IO.Path.GetExtension(strTemplateFilename) = ".dotm" Then
IO.File.SetAttributes(strTemplateFilename, IO.FileAttributes.ReadOnly)
End If

It seems very obvious now!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 7:21 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.