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

Not sure I understand you, but try adding, as the top line;

Cancel=True
'YOUR CODE



--
Regards
Dave Hawley
www.ozgrid.com
"Seeker" wrote in message
...
Book A has following code to save and close itself and same apply to Book
B,
but seems it loops back for book B to close even book B has already been
closed.
Whats wrong with it please?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
Application.CalculateBeforeSave = False

If Me.Name = "CashFlow.xls" Then
ActiveWorkbook.Save
ActiveWorkbook.SaveCopyAs Filename:="C:\" & Format(Date, "ddmmmyy") &
"A.xls"
Else
End If

Workbooks("B.xls").Save
Workbooks("B.xls").Close

Application.CalculateBeforeSave = True
Application.DisplayAlerts = True


End Sub


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
beforeclose Curt Excel Programming 1 August 16th 08 11:41 PM
BeforeClose event help [email protected] Excel Programming 3 June 22nd 07 10:02 AM
Deleting a menu in BeforeClose but user Cancels the Save LRL Excel Programming 2 November 17th 05 06:38 PM
BeforeClose Problem [email protected] Excel Programming 1 October 6th 05 02:15 PM
beforesave and beforeclose Adam Harding Excel Programming 2 July 25th 05 11:11 AM


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