user5497076
user5497076

Reputation: 11

Excel workbook won't close

I have an Excel workbook which I have problems closing properly.

Only if I press the little "x", it closes the Excel workbook, but not the Excel application. When I press the big red "X", the Excel application closes. So this works...

BUT... if I start by pressing the big red "X", nothing happens except that all the ribbon tools is greyed out, and so is everything in the menu under the Office-circle in the top left corner of the application. I can close the workbook by pressing the little "x", but I'm still not able to close the Excel application, and I have to "kill" it in the Windows Task Manager.

A few observations:

If I, before I open the Excel workbook, open an existing Excel workbook, and then opens the specific workbook, it can be closed properly pressing the big red "X" (only when the existing workbook is still open).

The problem ONLY exists for this specific workbook, so I must have made something which cause the problem. The workbook has VBA code, which could be the problem.

The problem is that I have many users using this workbook, and would like to have it work without these problems.

I really hope someone can help...

Upvotes: 1

Views: 1871

Answers (1)

user3819867
user3819867

Reputation: 1118

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
End Sub

Is an example of a code that would produce the issue you're having.
To solve the "issue" open the VBE (Alt+F11) and Break the execution (pause button).
I personally think the Cancel declaration is linked to a status of the workbook, make sure you have done what you were supposed to do with the workbook.

Upvotes: 1

Related Questions