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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable "Save As" in word document 1

Status
Not open for further replies.

Bitaoo

Programmer
Dec 18, 2002
81
0
0
US
Hello,

I appreciate your help in advance. I open a word
document in my VB6 program in this way:

Dim WD As Object
Set WD = CreateObject("Word.Application.8")
With WD
.documents.open FileName:="C:\Bita.doc"
.Visible = True
.displayalerts = False
End With

I don't know how can I disable "Save As..." in File menu
so the user cannot save this file in the other files?

Regards,
--Bita
 
Hi Bita

This code should sort you out.

Dim olapp As Word.Application
Dim MnuItem As CommandBarControl
Dim MnuCmd As CommandBarPopup
Set olapp = CreateObject("Word.Application")
olapp.Documents.Add
Set MnuCmd = olapp.CommandBars.ActiveMenuBar.Controls("File")
Set MnuItem = MnuCmd.Controls("Save &As...")
MnuItem.Enabled = False
olapp.Visible = True

You must include the Microsoft Office 10.0 Object Library and the Microsoft Word 9.0 Object Library in your project references also.

Hope it works !!!

Bobby.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top