Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JK JK is offline
external usenet poster
 
Posts: 78
Default Is it possible to prevent WB_BeforeClose with VBA?

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Is it possible to prevent WB_BeforeClose with VBA?

You can tell excel to stop monitoring events.

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



JK wrote:

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


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Is it possible to prevent WB_BeforeClose with VBA?

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




"JK" wrote in message
...
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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW CAN I PREVENT EXCEL FILES FROM BEING DELETED OR PREVENT TRASH ROB Excel Discussion (Misc queries) 2 April 2nd 07 01:13 PM
How to prevent marqueue clara New Users to Excel 1 March 22nd 07 05:17 PM
Prevent other from seeing VBA Ed Excel Discussion (Misc queries) 3 October 16th 06 07:27 PM
Prevent PageDown OJ[_2_] Excel Programming 3 May 24th 05 10:18 AM
prevent duplication Ben Blair Excel Discussion (Misc queries) 1 May 21st 05 03:59 AM


All times are GMT +1. The time now is 12:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"