Hi,
I've come across a similar problem where I want to perform an operation "after save". I tried the solution you suggested maccas but when the execution reached the "ThisWorkbook.Save" line it invoked the Workbook_BeforeSave method again. Once this was complete it returned to the first invocation of Workbook_BeforeSave and continued through to the end. The problem with this was that the workbook wasn't saved. I am using Excel 2002 as opposed to 2003 which Rick was using though - could this "problem/quirk" have been fixed in 2003?
I created a simple spreadsheet just to ensure that none of my other code was getting in the way and got the same result, this is the code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
MsgBox ("before save")
ThisWorkbook.Save
MsgBox ("after save")
End Sub
With this code I saw the "before save" message twice followed by the "after save" message twice.
Thanks,
Nick
|