Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Disable macros on a programmatically opening .xls file
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Disable macros on a programmatically opening .xls file
Thanks Dave. I was looking for a way to safely open the file, wipe out it's
entire vba project, and then save it, and run my code on it afterwards since all these files in question are being uploaded to me from users. My fear was the Workbook.Open code prior to wiping out the VBA Project inside of it. Funny I never thought of the OBVIOUS which is Events being False! Darn testing environments, I always forget the obvious!! Thanks for the reply, I really appreciate it, Matt "Dave Peterson" wrote in message ... 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 "Dave Peterson" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macros Disabled when opening file | Excel Discussion (Misc queries) | |||
"openinf file..."ENABLE MACROS...DISABLE MACROS" | Excel Discussion (Misc queries) | |||
Disable Macros --> Close File | Setting up and Configuration of Excel | |||
Opening a file and enabling macros automatically | Excel Discussion (Misc queries) | |||
Trouble opening an Excel file that contains macros | Excel Worksheet Functions |