View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Ed Ed is offline
external usenet poster
 
Posts: 217
Default amending the behaviour of the close button

Hi matt101,

You might be able to do that but I think it depends upon your version of Word.

Some versions (e.g. 2003) allow you to get at the event that happens when a
document is about to close (the DocumentBeforeClose event) and if you can
access that event you can arrange for your macro code to run.

For details of how to do this sort of thing, check this site:
http://www.word.mvps.org/FAQs/Macros...lassEvents.htm

If you get stuck, post back with your version of Word and someone may be
able to assist.

Regards.

Ed

"matt101" wrote:


Hello,

I have a macro which allows the user to save a document under a name
they specify by pressing a button. I want to remove all other methods
of saving, so while its easy to remove the buttons on the File menu and
Standard toolbar, is it possible to have the Close button in the top
right corner to display the same save option as in the following macro?
If so, what should be added to the macro?

Thanks in advance,

Sub CreateBackup()
ChangeFileOpenDirectory _
"\\servername\folderpath"
strDocName = InputBox("Enter the name of your document.")
ActiveDocument.SaveAs FileName:=strDocName, _
FileFormat:=wdFormatDocument _
, LockComments:=False, Password:="", AddToRecentFiles:=True, _
WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False,
SaveAsAOCELetter:= _
False
End Sub




--
matt101