Open Event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Anyone know how to open a work book through code and suppress the any code
that is in the open event of the book being opened?

I know you can do it manually by holding the shift key to go into design
mode so there must be a VBA equivalent mustn't there?
 
Hi Andy

Use EnableEvents

Sub test()
Application.EnableEvents = False
Workbooks.Open "C:\Data\test1.xls"
Application.EnableEvents = True
End Sub


Or put your code in this sub

Sub Auto_open()

End Sub

Must be in a normal module
If you use a Auto_open macro then this wil not run if you open the file with a macro
 
Thanks Ron

Andy



Ron de Bruin said:
Hi Andy

Use EnableEvents

Sub test()
Application.EnableEvents = False
Workbooks.Open "C:\Data\test1.xls"
Application.EnableEvents = True
End Sub


Or put your code in this sub

Sub Auto_open()

End Sub

Must be in a normal module
If you use a Auto_open macro then this wil not run if you open the file with a macro
 

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

Back
Top