Puzzled: Add-In work once?

P

Peter

Hello,

Thanks for reviewing my question. I am puzzled on why my add-in will only works once. I create a menu with a couple of menu items in Excel. One of the menu items display a dialog which works fine the first time. Select the same menu item again or any of the other menu item for that matter and nothing happens. It seems as if Excel is ignoring my add-in. The dialog is so basic that I cannot imagine how its causing a problem.

Any ideas or have you heard such a strange behavior?

Many Thanks
Peter
 
S

S.Vidyaraman

Hi,
One of the menu items display a dialog which works fine the first time.

How about the other Menu Items ? If you click on them (the first time
WITHOUT clicking the menu item you mention above), do they perform their
function always, or only once, or never ?

I am guessing at this stage, but this could be a problem with your buttons
in the menu. Are you using the same CommandBarButton object again and again
for creating multiple menu items ? Try using unique variables and see.
Hope this helps.
S.Vidyaraman
 
S

Siew Moi Khor [MS]

Could be a problem with scoping. See:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=#5#[email protected]
http://blogs.msdn.com/bowerm/archive/2004/06/22/162304.aspx

Siew Moi
---
This posting is provided 'AS IS' with no warranties, and confers no rights.
Sample code subject to http://www.microsoft.com/info/cpyright.htm


Peter said:
Hello,

Thanks for reviewing my question. I am puzzled on why my add-in will only
works once. I create a menu with a couple of menu items in Excel. One of
the menu items display a dialog which works fine the first time. Select the
same menu item again or any of the other menu item for that matter and
nothing happens. It seems as if Excel is ignoring my add-in. The dialog is
so basic that I cannot imagine how its causing a problem.
 
P

Peter

All,

Thanks for the great help. I made one correction and I still have the same problem however, the OnDisconnection function still gets called even though none of the menu items work after the first time and thus something is still going out of scope. So I am a little closer on fixing the problem.

Thanks again for pointing me in the right direction.

Peter
 
P

Peter

Siew,

I took care of the scope problem. However, the problem still exists. Here are additional clues. My add-in works fine on one PC but on another, it displays the dialog once and them all the other menu items stop working. If I delete the controls on this dialog so its an empy dialog, my add-in works fine - meaning I can select the menu item that displays the dialog any number of times.

Even when all the menu items stop working and I close Excel, my add-in's OnDisconnection () still gets called.

Do you have any other suggestions?

Many thanks
Peter
 
S

Siew Moi Khor [MS]

Good to hear ;-)

Siew Moi
---
This posting is provided 'AS IS' with no warranties, and confers no rights.
Sample code subject to http://www.microsoft.com/info/cpyright.htm


Peter said:
Siew,

I re-read your suggestion and references and found that I still had local
CommandBarButton defined. When I made the variable a class member it took
care of the problem. Puzzle solved!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top