By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,739 Members | 1,523 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,739 IT Pros & Developers. It's quick & easy.

Help Dispatching Events on excel commandbar buttons

P: n/a
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.msoControlButt on,
Parameter="Greetings")
button=self.toolbarButton=
DispatchWithEvents(button, ButtonEvent)
button.BeginGroup = True
button.Width = "34"
if captions:
button.Caption =captions[i]
if tooltips:
button.TooltipText = tooltips[i]
i+=1
----------------------end Function------------------------------
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.