Share via

When Workbook.Close command closes a workbook, Workbook_Activate event of any still open workbook doesn't run. Is there a fix for this?

Anonymous
2012-01-18T11:08:11+00:00

I have found that when I close my Excel workbook using the "Workbook.Close" command, the Workbook_Activate event procedure in any workbook that is still open does not run. Is there a work-around for this?

In the workbook that I am closing there is no other code. The only code it contains is the command "Workbook.Close" within the Workbook_SheetSelectionChange event procedure. In the workbook that is still open when the first is closed the only code it contains is the command "Beep" (which I placed a breakpoint on) in the Workbook_Activate event procedure.

I have found that if I close the workbook using the MacScript command - MacScript ("tell application ""System Events"" to keystroke ""w"" using command down") - it closes properly and the still open workbook's Workbook_Activate event procedure runs. But this is not really a clean way to close a workbook and there are problems with it because it causes the Workbook_BeforeClose event procedure to run twice, for some reason.

Anyone know how to do a clean close?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-01-19T05:29:45+00:00

Thank you for visiting the Microsoft Answers Community site. The issue you posted would be better suited in the VBA community. Please visit the link below to find a community that will offer the support you request.

http://social.msdn.microsoft.com/Forums/en/isvvba/threads

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2012-01-19T09:18:04+00:00

    Thanks, I'll do that.

    Was this answer helpful?

    0 comments No comments