After Save - 1 more question
It will, but the SaveAsUI argument will be true in that case so you can test
for it
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim sFile
Application.EnableEvents = False
'<Optional - this would be before save code
Cancel = True
If SaveAsUI Then
sFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If sFile < False Then
ThisWorkbook.SaveAs sFile
End If
Else
ThisWorkbook.Save
End If
'<Optional - this would be after save code
Application.EnableEvents = True
End Sub
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Steph" wrote in message
...
Thanks Tom. One more question -
What if the user selects Save As? Does that throw a monkey wrench in the
code?
"Tom Ogilvy" wrote in message
...
That would be the basic approach.
--
Regards,
Tom Ogilvy
"Steph" wrote in message
...
Thanks for all of your help. Just to confirm - by combining the
suggestions
of your posts, is the below code the proper way to perform the After
Save
Event? Thanks!
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
'<Optional - this would be before save code
application.enableevents = false
ThisWorkbook.Save
application.enableevents = true
'<Optional - this would be after save code
End Sub
|