PDA

View Full Version : Disabled SaveAs in Specific Word Document



navinraj
02-13-2008, 05:40 PM
Sorry to bother you all. Well I have found a code that actually disabled "SaveAs" in MS Word, But the problem is the macro applied to all word document..

Here is the code

commandbars("File").Controls("Save As...").Enabled=True

I need to be apply on a specific document only..

Thanks

Regards

Navin Raj:help :dunno

lucas
02-15-2008, 10:21 AM
moved to the Word forum...

you might need to look into

Document_Open and Document_Close

disable on open and re enable on close so it doesn't affect other documents. It might affect any that are open at the same time though.

fumei
02-15-2008, 11:23 AM
In THAT Word document, write a overwrite Sub.

Sub FileSaveAs()
Msgbox "Na-na-na-na! File SaveAs not available."
End Sub

File > SaveAs will display the message . Nothing else will happen.

I have to point out that restriction of SaveAs will not (by any stretch of the imagination) really restrict anyone from getting a copy of the document. If this is a "security" type of thing you are attempting, note that disabling SaveAs is very very weak security. Actually, it is zero security.

Note: overwriting SaveAs does nothing to Save. The Save command and button still function the same way.

Now, I have to ask though. Is your question actually:

I have Word open with, say, two documents open. I want to disable SaveAs on THAT one...but not the other one.

That would be different.

There is no way - unless you are going to use VBA to write a new procedure (by code) into the VBAProject of another document - to point to a document and say "No SaveAs".

You can, with the Sub FileSaveAs code above, make a specific document have no SaveAs.