Unhook (then rehook) workbook events???

  • Thread starter Thread starter Tim Williams
  • Start date Start date
T

Tim Williams

I'm working with an application which automates Excel to host a "Report"
workbook. There are various types of "sessions" during which a user can
interact with the workbook in a more or less limited way (eg. saving of the
workbook under another name is not permitted).

It seems that in one particular session type the controlling application has
hooked the Workbook_Beforesave event such that choosing "Save" from the
Excel menu calls a particular piece of code but does not save the workbook.

Anyone know whether it's possible (without access to the controlling code)
to "unhook" the Beforesave event temporarily so that I can save the
workbook, and then "rehook" the event ?

Thanks for any ideas,
Tim.
 
Application.EnableEvents = False
' run whatever you want
Application.EnableEvents = True

since it's application level, not sure if it's what you want. It also
disables more than just the BeforeSave event.
 
Tim,

Thanks - I hadn't thought of that. Will try tomorrow and post back
with the outcome.

Tim.
 
OK - works well. Thanks for the tip.

Tim.



Tim Williams said:
Tim,

Thanks - I hadn't thought of that. Will try tomorrow and post back
with the outcome.

Tim.
 
Back
Top