Changing the file name via a Macro when choosing Close Window via

J

Jenny

Hi,

I would like to create a Macro (based on the one below) to change the file
name of a document via a prompt if the user chooses to close the document via
the X (Close Window) or if the user chooses Alt+F4.

What would be the appropriate name for the subroutine for this Macro?

Thanks.


Sub FileSave()
' Override for standard save command
If ActiveDocument.Path <> "" Then ' file has been saved before
ActiveDocument.Save
Else
Dim strJobNumber As String
strJobNumber = InputBox("Enter Job Number")
With Application.Dialogs(wdDialogFileSaveAs)
.Name = strJobNumber & " FM-DM-049-o1 agenda.doc"
.Show
End With
End If
End Sub
 
G

Graham Mayor

Sub AutoClose()


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

Jenny

Thank you. That did it.


Graham Mayor said:
Sub AutoClose()


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top