Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Bypass 'Open as read-only?' dialog from VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HFSchreiner - 08 Nov 2004 00:01 GMT
Hi,

I am using MS Word 2002 SP3, XP Pro

I am using VBA to insert a number of boiler plates (in a pre-defined list)
into a blank document.

Prior to inserting the boiler plate, the code needs to check the
boilerplates' margin and orientation properties in order to adjust same in
the receiving doc.

I have saved all boiler plates with 'Tools/Options/Security/File sharing
options for this document' set to read-only; to require user to explicitly
open as read-write to (help) prevent the saving of all but explicit changes.

Upon execution of:

   ' get boilerplate first section margins and orientation
   Set oBoilerPlate = Documents.Open(Filename:=sBPFilePath, Visible:=False)
' open the boiler plate
   With oBoilerPlate.Sections.First.PageSetup
       propBPLeftMargin = .LeftMargin
       propBPRightMargin = .RightMargin
       propBPOrientation = .Orientation
   End With
   oBoilerPlate.Close (wdDoNotSaveChanges)

the user is presented with the:
'[filename]... should be opened as read-only unless changes to it need to be
saved. Open as read-only?' dialog.

Is there a method to bypass this dialog?
It would not be a bother, had I only to insert a few boiler plates, but
there can be as many as 150...

(I realize that there is a .dll from Microsoft to allow file property
changes from code - I am trying to avoid going that route because of
potential distribution/installation problems).

Your help is Greatly appreciated!

Thank you!

Fred Schreiner
Stuart - 11 Nov 2004 13:35 GMT
Just a thought...Have you tried adding Application.DisplayAlerts=wdAlertsNone
to the top of your code?

Stuart

> Hi,
>
[quoted text clipped - 40 lines]
>
> Fred Schreiner
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.