G
Guest
I have some code set for closing out of a word doc. The
code itself works fine, but I would like to use it on
either the save/save as or close events. Currently I
have it set up under an "autoclose" module. It works
fine if the user is closing the doc (obviously)...
however, most users will likely try using the "save" menu
option. Here is what I currently have:
Sub autoclose()
'defines variable for filename
Dim strFileNM As String
strFileNM = ActiveDocument.Variables("SOPName").Value
'changes directory default to SOP folder
ChangeFileOpenDirectory _
"C:\Documents and Settings\Owner\My Documents\SOPs\"
'sets filename to value in "SOPName" bookmark & saves as
word doc
'ActiveDocument.SaveAs FileName:=strFileNM,
fileformat:=wdWordDocument
With Dialogs(wdDialogFileSummaryInfo)
.Title = strFileNM
.Execute
End With
End Sub
Thanks!
code itself works fine, but I would like to use it on
either the save/save as or close events. Currently I
have it set up under an "autoclose" module. It works
fine if the user is closing the doc (obviously)...
however, most users will likely try using the "save" menu
option. Here is what I currently have:
Sub autoclose()
'defines variable for filename
Dim strFileNM As String
strFileNM = ActiveDocument.Variables("SOPName").Value
'changes directory default to SOP folder
ChangeFileOpenDirectory _
"C:\Documents and Settings\Owner\My Documents\SOPs\"
'sets filename to value in "SOPName" bookmark & saves as
word doc
'ActiveDocument.SaveAs FileName:=strFileNM,
fileformat:=wdWordDocument
With Dialogs(wdDialogFileSummaryInfo)
.Title = strFileNM
.Execute
End With
End Sub
Thanks!