Opening a file and disabling open events

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

Guest

Hi All
I have a an application (workbook) running some VBA code, I want this code
to open another application (workbook) but prevent its open events being
fired to prevent the opened workbook VBA code running.

How do I do this?

Cheers
 
Nigel,

Something like the following should work. You'll probably want to add some
error checking.

Dim WB As Workbook
Application.EnableEvents = False
Set WB = Workbooks.Open("C:\Book1.xls")
Application.EnableEvents = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
 
Thanks Chip, works a dream!

Chip Pearson said:
Nigel,

Something like the following should work. You'll probably want to add some
error checking.

Dim WB As Workbook
Application.EnableEvents = False
Set WB = Workbooks.Open("C:\Book1.xls")
Application.EnableEvents = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is 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

Back
Top