Help Dispatching Events on excel commandbar buttons

E

Eric

I have the following function which creates buttons on Excel
commandbar. The problem i can't get the buttons to hook up to events.
For example, if i create four buttons only the fourth one fires the
ButtonEvent, the rest do nothing. What am i doing wrong.

Please help

Eric
--------------begin Function--------------------------
def CreateButton(self,menubar,buttons,images,captions, tooltips):
"""Create buttons on the Excel bar"""

if menubar is not None:
if buttons is not None:
i=0
for button in buttons:
button =
menubar.Controls.Add(Type=constants.msoControlButton,
Parameter="Greetings")
button=self.toolbarButton=
DispatchWithEvents(button, ButtonEvent)
button.BeginGroup = True
button.Width = "34"
if captions:
button.Caption =captions
if tooltips:
button.TooltipText = tooltips
i+=1
----------------------end Function------------------------------
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top