I do it like this:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call '...you macro here
End Sub
Those three lines fo code go into 'ThisWorkbook' sheet.
HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
"Udo" wrote:
> Hi Excelperts,
>
> there are several macros I created that run automatically when the
> workbook is opened. I have also some on closing the workbook. But I
> couldn't figure out yet how to make a macro run when the file is
> saved. To be very specific: if you close the file without saving, it
> should not run, only when the file is saved. This is when you close
> and save in one step or when you save it and continue to work on it.
> I've tried workbook_save, on_save, auto_save. but it didn't work out.
> So, any hint how to do it?
>
> Thanks in advance
> hamster
>
|