In Word,I have a custom toolbar(commandbars).I put a custom controlButton in it , I choose
an icon picture(iconFace)and name(caption) it "Paco".
Here I add another controlButton and I copy the image of the first controlButton :
Sub NewBouton()
Set newB = CommandBars("Cast").Controls.Add(Type:=msoControlButton)
With newB
.Caption = "John"
.Style = msoButtonIconAndCaption
changeFaces ' Calling a Sub
.PasteFace ' Paste the first botton picture
.OnAction = "btnClic" ' Sub to go on click
End With
'This sub copy the picture from the first button
Sub changeFaces()
Set newControl = CommandBars.FindControl _
(Type:=msoControlButton, _
ID:=CommandBars("Cast").Controls("Paco").ID)
newControl.CopyFace
End Sub
Now I need to catch the click event. I want to know witch button was click and read is caption. example "John"
I start with something like this:
Sub btnClic(ByVal ctr As CommandBarButton)
Dim a As CommandBarButton
a = ctr
Dim b As String
b = a.Caption
End Sub
But it's more vb .net . I don't know how to put the Handle click_event
thank's
Gate
an icon picture(iconFace)and name(caption) it "Paco".
Here I add another controlButton and I copy the image of the first controlButton :
Sub NewBouton()
Set newB = CommandBars("Cast").Controls.Add(Type:=msoControlButton)
With newB
.Caption = "John"
.Style = msoButtonIconAndCaption
changeFaces ' Calling a Sub
.PasteFace ' Paste the first botton picture
.OnAction = "btnClic" ' Sub to go on click
End With
'This sub copy the picture from the first button
Sub changeFaces()
Set newControl = CommandBars.FindControl _
(Type:=msoControlButton, _
ID:=CommandBars("Cast").Controls("Paco").ID)
newControl.CopyFace
End Sub
Now I need to catch the click event. I want to know witch button was click and read is caption. example "John"
I start with something like this:
Sub btnClic(ByVal ctr As CommandBarButton)
Dim a As CommandBarButton
a = ctr
Dim b As String
b = a.Caption
End Sub
But it's more vb .net . I don't know how to put the Handle click_event
thank's
Gate