PDA

View Full Version : XL2000 Add-In Question:



GTO
10-06-2009, 03:53 AM
Greetings:

Due to a problem running an add-in, I would like to disprove a general bug, as I suspect my 'poor ol' laptop' is just too close to toasted...

In short - an add-in correctly calls/runs code called from Workbook_Open upon running Excel.

It does not however, call/run code from Workbook_BeforeClose upon exiting the app.

It does call/run Workbook_BeforeClose upon un-installing (Tools|Add-Ins|un-tick) the add-in.

I have searched and see find no documentation as to this behaviour - thus suspect my computer/app problems/missing patch/whatever...

If anyone w/2000 could do this simple test (or simply state from knowledge), I would appreciate it.

In Excel 2000, install an add-in with nothing but:

Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
MsgBox "Closing"
End Sub

Private Sub Workbook_Open()
MsgBox "Opening"
End Sub


Open and close the app a couple of times. Presuming you get the msgbox when exiting, my belief is confirmed.

Thank you in advance,

Mark

tpoynton
10-06-2009, 05:35 PM
I dont have 2000, but I've seen this happen on Excel 2004...I installed the test as xla, opened and closed Excel several times, and eventually both the workbook open and close failed to work for both the add in with your code, and my add in.

I know this doesnt exactly help with your theory, and for that I apologize...I was just curious. un- and re-installing the add in provides a temporary fix for me, but it always stops working after a little while, for reasons that elude me.

GTO
10-06-2009, 05:54 PM
Thank you so much tpoynton.

Am I correct in taking it that you have the Mac version? I think the Open and BeforeClose events are the same (though I've never used Mac), and just wanted to ensure I am understanding correctly.

In Excel 2003 for Win I haven't (leastwise not yet) experienced any problems w/either open or close, but in 2000, Open seems to work consistently, but BeforeClose just does not...

Thank you again for the info, it is helpful to at least know it is not unheard of :think: .

Mark

tpoynton
10-07-2009, 06:36 AM
Indeed, I do have a Mac Mark - I also use the add in with no trouble in Excel 2007 and 2003. Other folks have reported the issue with the Mac version to me...I use the open and beforeclose events to build a menu. As you note, uninstalling and reinstalling the add in works, but then when Excel itself opens and closes, sometimes things go awry. I've never seen this on a windows version - until you posted here!

Good luck, Tim

tpoynton
10-07-2009, 06:51 AM
duplicate post, my apologies - you can see I waited a full 15 minutes before clicking the button again :)