Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Closing a Workbook


Hi!
If I have a drawn button and assign a macro that looks like this:
[Begin Code]
Sub ExitWarrantybook()
Application.ScreenUpdating = False
ActiveWorkbook.Save
Sheets("Home Page").Select
Range("H26").Select
Selection.ClearContents
ActiveWorkbook.Close
ActiveWorkbook.Saved = True
Application.ScreenUpdating = True
End Sub
[end Code]
And I have code in the "ThisWorkbook" section that looks like this:
[begin code]
Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
ActiveWorkbook.Save
ActiveWorkbook.Saved = True
With ActiveWindow
..DisplayHeadings = True
..DisplayOutline = True
..DisplayWorkbookTabs = True
End With
Application.ScreenUpdating = True
End Sub
[end code]
Do both sets of code run before the workbook closes?


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=500427

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Closing a Workbook


I think your problem is not that they are not running, but that you save
the workbook before selecting the "Home Page" and all that. Try moving
the ActiveWorkbook.Save line to after those modification lines. (also
it may be safer to use ThisWorkbook instead of ActiveWorkbook, it's not
quite clear what you are trying to do).

Szalapski


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=500427

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
Closing Hidden Workbook when Active Workbook is Closed SusanK521 Excel Programming 5 September 24th 05 12:27 AM
Help with closing down a workbook?? Don Excel Worksheet Functions 1 May 9th 05 04:05 AM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM
Closing a workbook Belinda Excel Programming 2 January 15th 04 01:27 PM
closing workbook Sam Dickins Excel Programming 1 November 27th 03 03:43 PM


All times are GMT +1. The time now is 12:07 AM.

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"