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_BeforeClose

Hello everyone,

I placed this post a few days ago, but my question remains
unaswered. This is a re-word of that post.

I have a large application that “hides” Excel on startup (gridlines,
headings, visibility, etc), then restores everything on exit.
Everything works fine if closing the workbook manually, the problem
appears when trying to close via a procedure. The following is a
simplified example of the code.

Sub CloseMe()
ThisWorkbook.Close savechanges:=True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim wk As
Worksheet
Range("A1").Interior.ColorIndex = 4
Application.DisplayFormulaBar = True
ActiveWindow.DisplayGridlines = True
End Sub

If I step thru the code starting at CloseMe code, it steps thru to the
Workbook_BeforeClose procedure. There, the first line gets executed,
but nothing happens on the next two. Yet when I close the workbook
manually, it works as expected. I’ve tried this on Xl97 & 2007, with
the same results.

I have to admit, this one caught me by surprise. I can’t seem to find
anything regarding this in the groups/internet. Any advice would be
most appreciated.

Thanks for your help,

regards,

Dave U

 
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
Workbook_BeforeClose Alan McQuaid via OfficeKB.com Excel Programming 3 June 13th 06 04:36 PM
Workbook_BeforeClose [email protected] Excel Programming 1 April 11th 06 10:53 AM
workbook_beforeClose GB Excel Programming 2 March 1st 06 12:39 AM
Workbook_BeforeClose PO Excel Programming 2 January 30th 05 05:07 PM
Workbook_BeforeClose Don Guillett[_4_] Excel Programming 1 August 31st 04 02:27 PM


All times are GMT +1. The time now is 10:17 PM.

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

About Us

"It's about Microsoft Excel"