Workbook_beforeClose not working in add-in?

muffins

Board Regular
Joined
Jun 18, 2002
Messages
86
I've the following code in my add-in. Strangely the code in the Workbook_Open event executes as expected, but not the Workbook_beforeClose event. May I know the reason?

thank you very much.

*********************************************

Private Sub Workbook_Open()
msgbox "hi!"
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
msgbox "bye!"
End Sub
 
actually my macro is simple.. to add a customised menu to workbook A and remove the menu when the workbook is closed so that the menu will not be shown when other workbooks are opened.

That is to say, i hope the add-in will be closed when workbook A is closed, and loaded when workbook A is opened.
This message was edited by muffins on 2002-11-06 04:04
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
You could either:

1. Put all the code to add and remove the customised menu in workbook A, or

2. Close the Add-In in the Workbook_BeforeClose event procedure in workbook A.
 
Upvote 0
I've the following code in my add-in. Strangely the code in the Workbook_Open event executes as expected, but not the Workbook_beforeClose event. May I know the reason?

thank you very much.

*********************************************

Private Sub Workbook_Open()
msgbox "hi!"
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
msgbox "bye!"
End Sub


The problem is that you need to install the service pack for Excel 2000.
http://support.microsoft.com/kb/q248172/

Jon.
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top