Help Dispatching Events on excel commandbar buttons

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric

    Help Dispatching Events on excel commandbar buttons

    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(se lf,menubar,butt ons,images,capt ions, 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.Control s.Add(Type=cons tants.msoContro lButton,
    Parameter="Gree tings")
    button=self.too lbarButton=
    DispatchWithEve nts(button, ButtonEvent)
    button.BeginGro up = True
    button.Width = "34"
    if captions:
    button.Caption =captions[i]
    if tooltips:
    button.TooltipT ext = tooltips[i]
    i+=1
    ----------------------end Function------------------------------
Working...