control array with events

S

Shinya

I am trying to add dynamic drop down menu in my office com addin
toolbar. I use control array for drop down menu, but
I can only get the event for the first one instead of each menu item

how can I fix this so that events can be generated in each menu item

Dim WithEvents cbeButton As Office.CommandBarButton
Dim cbcButton() As Office.CommandBarButton

private sub CreateMenu()

for i = 0 to 3
ReDim Preserve cbcCatalogButton(i)
cbcButton(i).caption = i
set cbeButton = cbcButton(0)
next i

end Sub
Private Sub cbeCatalogButton_Click(ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean)

msgbox "hello"
end Sub

Shinya
 

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