Disable macro through automation

  • Thread starter Thread starter Scott Wallace
  • Start date Start date
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
 
Scott

I think you need:

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

or the equivalent in VB.NET

Regards

Trevor
 
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
 
Back
Top