Disable macros on a programmatically opening .xls file
Application.enableevents = false
'your code to open the other workbook
application.enableevents = true
Will stop the Workbook_open event in the other workbook from firing.
You may want to disable events whenever you do something to that other
workbook--you could be firing a worksheet_change or workbook_beforeclose
unintentionally.
Matt wrote:
If I am opening an .xls file using code (VBA), how can I disable the macro's
from running on it programmatically? I tried ".AutomationSecurity =
msoAutomationSecurityForceDisable" but this kills my macro in the middle of
itself running as well?
Sorry for the bold, I cant turn it off for some reason.
Matt
--
Dave Peterson
|