Is it possible to prevent WB_BeforeClose with VBA?

  • Thread starter Thread starter JK
  • Start date Start date
J

JK

When opening and then closing WB1 from WB2 I don't want the
Workbook_BeforeClose macros to execute in WB1. Holding down the shift will
manually do this, but is there a way with VBA? Thank you.

Jim Kobzeff
 
You can tell excel to stop monitoring events.

application.enableevents = false
wb1.close savechanges:=true 'false
application.enableevents = true
 
Jim,

Try something like

Application.EnableEvents = False
WB1.Close
Application.EnableEvents = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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