LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Workbook.close & beforeclose

Hello,

I’ve searched the groups, but can’t seem to find anything that quite
addresses this, hoping someone can tell me where I’m going wrong.

I have the following code in the BeforeClose event :

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Dim wk As Worksheet

For Each wk In ThisWorkbook.Worksheets
wk.Visible = xlSheetVisible
Next wk

End Sub

When I close the workbook manually, it works as expected. But if I
run
“ThisWorkbook.Close savechanges:=False” from a procedure, it doesn’t.
 
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
'BeforeClose' code problems:book won't close if more than one book is open Ed from AZ Excel Programming 0 September 18th 07 03:59 PM
Need code to close minimized workbooks in BeforeClose event Cheryl Excel Programming 3 August 17th 07 10:53 PM
Close workbook with "Cancel=TRUE" in the BeforeClose()" Wellie[_3_] Excel Programming 1 October 16th 04 09:46 PM
Workbook BeforeClose Bug John Camburn Excel Programming 0 July 9th 04 09:29 PM
File won't close when "beforeclose" event is used. David G[_3_] Excel Programming 4 December 8th 03 04:22 AM


All times are GMT +1. The time now is 04:05 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"