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: 363
Default Excel 2007 Craches when closing via macro code

When i close a workbook through code such as :

sub button6()
Application.DisplayAlerts = False
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub

and

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Dim WB As Workbook
For Each WB In Application.Workbooks
Debug.Print WB.Name
If WB.Name < ThisWorkbook.Name Then
If WB.Windows(1).Visible = True Then Exit Sub
End If
Next
Sheets("Navigation Sheet").Select
Application.Quit
End Sub


I get an ERROR, prompts me to \send report to MS or not.

If i open Excel and a blank sheet and then exit excel i get No error, so it seem to be ONLY when
exiting via code.

How do i fix this?


Corey....



 
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
Why doesn't Excel 2007 record charting and office art macro code? NOLuckMatt Excel Discussion (Misc queries) 0 August 17th 07 02:38 PM
How to code on Macro on saving and closing a file? Eric Excel Worksheet Functions 1 June 10th 07 01:32 PM
CLosing Excel 2007 with personal macro workbook Kato Wilbur Excel Discussion (Misc queries) 3 March 13th 07 09:59 PM
Macro Code for closing excel... Bonbon[_4_] Excel Programming 5 April 12th 06 12:57 PM
Changing VBE WS-component name in code craches excel 97 Nick Dreyer Excel Programming 5 December 5th 05 08:48 AM


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