Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent MS Word saving document from Visual Basic 1

Status
Not open for further replies.

chindas

Programmer
May 18, 2006
14
ES
Hi all,

I´d like to prevent a word document being saved from my Visual Basic 6 application.

I´d open the word document using Word 9.0 libraries, using Open method.

Any ideas? Thanks


Dim oWordApp as Word.Application
Set oWordApp = New Word.Application
oWordApp.Documents.Open Filename:="c:\test.doc", Visible:=True
 
Have you tried this:
Code:
oWordApp.Documents.Open Filename:="c:\test.doc",
[b]ReadOnly:=True,[/b] Visible:=True

HTH

---- Andy
 
Well.. it´s a good answer.. but what i´d really like to do it´s to prevent someway user access to a remote dir, where the document is loaded from, i.e. user should not know where the document is saved in.

The only thing the user should know is that pressing Save button, he will save the doc where it was opened by default

I don´t know if that could be possible coding any event or disabling/hiding some menu or buttons in Word..

Thanks guys
 
You could try trapping the event
Code:
Dim WithEvents oWordApp As Word.Application

Private Sub oWordApp_DocumentBeforeSave(ByVal Doc As Word.Document, SaveAsUI As Boolean, Cancel As Boolean)
    Cancel = True
End Sub
 
Thanks Golom,
your help was very useful for me,

regards


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top