ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save As Event (https://www.excelbanter.com/excel-programming/360074-save-event.html)

Sandy

Save As Event
 
My save as event:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.Run "MyFile.xls!MyMacro"
End Sub
No longer fires on save. The macro exists and will run from a hot key.
What could have changed that it will not run on save?
Thanks!

Bob Phillips[_6_]

Save As Event
 
Sounds like it is not in the ThisWorkbook code module.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Sandy" wrote in message
...
My save as event:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As

Boolean)
Application.Run "MyFile.xls!MyMacro"
End Sub
No longer fires on save. The macro exists and will run from a hot key.
What could have changed that it will not run on save?
Thanks!




Jim Thomlinson

Save As Event
 
Anywhere in your world do you have code that disables events? if so then
possibly your code errored out and the events were nort re-enabled, or you
were debugging and exited exectuion prior to re-eneabling or there is an
issue where you just neglect to re-enable the events. In any case jsut run
this code to reset your events...

sub test
application.enableevents = true
end sub

Now your events should be firing again. As always when you play with these
settings make sure your errorhandling is bullet proof and that your progarm
flow always resets the changes you make.
--
HTH...

Jim Thomlinson


"Sandy" wrote:

My save as event:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.Run "MyFile.xls!MyMacro"
End Sub
No longer fires on save. The macro exists and will run from a hot key.
What could have changed that it will not run on save?
Thanks!


Sandy

Save As Event
 
That got it thanks!!!

"Jim Thomlinson" wrote:

Anywhere in your world do you have code that disables events? if so then
possibly your code errored out and the events were nort re-enabled, or you
were debugging and exited exectuion prior to re-eneabling or there is an
issue where you just neglect to re-enable the events. In any case jsut run
this code to reset your events...

sub test
application.enableevents = true
end sub

Now your events should be firing again. As always when you play with these
settings make sure your errorhandling is bullet proof and that your progarm
flow always resets the changes you make.
--
HTH...

Jim Thomlinson


"Sandy" wrote:

My save as event:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.Run "MyFile.xls!MyMacro"
End Sub
No longer fires on save. The macro exists and will run from a hot key.
What could have changed that it will not run on save?
Thanks!



All times are GMT +1. The time now is 02:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com