Disable macro's

T

TJ

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
 
C

Chip Pearson

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)
 
T

TJ

Thanks Chip
Chip Pearson said:
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top