ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable macro's (https://www.excelbanter.com/excel-programming/396882-disable-macros.html)

TJ[_5_]

Disable macro's
 
Hi

I am currently writing a procedure that opens another workbook using
Workbooks.Open.. The workbook that is being opened contains macros which I
want disabling. Is there anyway to stop this? I am using Excel 2003

Thanks
TJ



Chip Pearson

Disable macro's
 
Try code like the following:

Dim Sec As Long
Sec = Application.AutomationSecurity

Application.EnableEvents = False
Application.AutomationSecurity = msoAutomationSecurityForceDisable
' open the workbook
Application.EnableEvents = True
Application.AutomationSecurity = Sec


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"TJ" wrote in message
...
Hi

I am currently writing a procedure that opens another workbook using
Workbooks.Open.. The workbook that is being opened contains macros which I
want disabling. Is there anyway to stop this? I am using Excel 2003

Thanks
TJ



TJ[_5_]

Disable macro's
 
Thanks Chip
"Chip Pearson" wrote in message
...
Try code like the following:

Dim Sec As Long
Sec = Application.AutomationSecurity

Application.EnableEvents = False
Application.AutomationSecurity = msoAutomationSecurityForceDisable
' open the workbook
Application.EnableEvents = True
Application.AutomationSecurity = Sec


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"TJ" wrote in message
...
Hi

I am currently writing a procedure that opens another workbook using
Workbooks.Open.. The workbook that is being opened contains macros which
I want disabling. Is there anyway to stop this? I am using Excel 2003

Thanks
TJ






All times are GMT +1. The time now is 03:28 PM.

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