Reply
 
Thread Tools Display Modes
  #1   Report Post  
matt101 matt101 is offline
Junior Member
 
Posts: 0
Default amending the behaviour of the close button

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

Last edited by matt101 : July 6th 07 at 01:12 PM
  #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

  #3   Report Post  
matt101 matt101 is offline
Junior Member
 
Posts: 0
Default

Thanks Ed!

I will take a look.

Quote:
Originally Posted by Ed View Post
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
  #4   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

You're welcome :-)

Regards.

Ed

"matt101" wrote:


Thanks Ed!

I will take a look.

Ed;270641 Wrote:
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
-





--
matt101

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify custom toolbar button behaviour Robert Werner Microsoft Word Help 1 August 13th 05 04:20 AM
Change Behaviour of open button in Word Change Behaviour of open button in Word Microsoft Word Help 0 July 14th 05 02:46 PM
Missing Close button DSUK Microsoft Word Help 3 March 31st 05 12:45 PM
Diable close button Cor van der Bliek Microsoft Word Help 6 February 4th 05 04:12 PM
Close Button in Word JohnDeeze Microsoft Word Help 1 November 30th 04 06:32 PM


All times are GMT +1. The time now is 01:24 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"