View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default How do I turn off macros when programmatically opening a workbook.

Phil

If you're auto macros are of the AutoOpen variety, they won't execute when
you open a workbook via code. If they are events like Workbook_Open, then

Application.EnableEvents = False
Workbooks.Open etc..
Application.EnableEvents = True

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

PhilBerkhof wrote:
Hi,
I'm trying to turn off a macro that runs when I open a workbook
programmatically. I'm not sure how to do this. I want to do
(programmatically) the equivalent of pressing the 'Disable macros'
button when I open this program. I have workarounds if this doesn't
work, but would like to do something quick and easy!

Thanks!
Phil