Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel crashes with .Close command
I am using Excel 97.
I have the following code : For Each wb In Application.Workbooks If wb.Name < ThisWorkbook.Name Then wb.Close End If Next wb At the end of the run of my macro, I have only two spreadsheets. The Macro spreadsheet. And the report. Whenever it hits wb.close, and spreadsheet is not the macro spreadsheet, Excel crashes. I have tried several things. Including closing the spreadsheet by name and not cycling the the spreadsheets. Nothing worked. C++ debugger claims that it is a sharing violation. This is not true because I am only one using the spreadsheet. In order to get the job done. I save, then quit Excel. I do not want this, I prefer the code above. Does anyone know why wb.close might cause Excel to crash? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy command causes Excel to close | Excel Discussion (Misc queries) | |||
Excel crashes on "Close" Visual Basic error 400 | Excel Discussion (Misc queries) | |||
Open, Save and close Excel 2007 file with a cmd command | Excel Discussion (Misc queries) | |||
Is there a command line "switch" To close Excel | Excel Discussion (Misc queries) | |||
Excel 2003 crashes when I close any worksheet | Excel Discussion (Misc queries) |