Disable macro through automation

S

Scott Wallace

Is there a way to disable macros when calling Excel through a language such
as VB.NET? I've got an Excel file that has macros that run on startup. I
don't want the macros to fire when I open through VB. I can't seem to find
a property or setting in Excel that simply says to disable all macros from
running. Yes, I do want to disable all macros either through a setting in
Excel or through the automation, so please - no comments on why I might not
want to do this.

Thanks,
Scott
 
T

Trevor Shuttleworth

Scott

I think you need:

Application.EnableEvents=False
' your code
Application.EnableEvents=True

or the equivalent in VB.NET

Regards

Trevor
 
S

Scott Wallace

That did the trick. Thank you very much!

Trevor Shuttleworth said:
Scott

I think you need:

Application.EnableEvents=False
' your code
Application.EnableEvents=True

or the equivalent in VB.NET

Regards

Trevor
 

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