A
Angelos
Hi,
If you add a new toolbar with one button and then you double click on
the toolbar button, the Click event of the button is fired three times.
Is this a known bug? Is there some sort of workaround?
Here is the code to reproduce the behaviour
Private toolbar As CommandBar
Private WithEvents toolbarButton As CommandBarButton
Private Sub Document_New()
Set toolbar = CommandBars.Add("Test", 1, missing, True)
Set toolbarButton = toolbar.Controls.Add(1)
toolbarButton.Style = msoButtonCaption
toolbarButton.Caption = "Click me"
toolbarButton.Tag = "something unique"
toolbar.Visible = True
End Sub
Private Sub toolbarButton_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
Call Selection.Range.InsertAfter("Button clicked " &
DateTime.Time$)
Call Selection.Range.InsertParagraphAfter
End Sub
Thank you in advance
Angelos
If you add a new toolbar with one button and then you double click on
the toolbar button, the Click event of the button is fired three times.
Is this a known bug? Is there some sort of workaround?
Here is the code to reproduce the behaviour
Private toolbar As CommandBar
Private WithEvents toolbarButton As CommandBarButton
Private Sub Document_New()
Set toolbar = CommandBars.Add("Test", 1, missing, True)
Set toolbarButton = toolbar.Controls.Add(1)
toolbarButton.Style = msoButtonCaption
toolbarButton.Caption = "Click me"
toolbarButton.Tag = "something unique"
toolbar.Visible = True
End Sub
Private Sub toolbarButton_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
Call Selection.Range.InsertAfter("Button clicked " &
DateTime.Time$)
Call Selection.Range.InsertParagraphAfter
End Sub
Thank you in advance
Angelos