Avatar of s_federici

asked on 

Adding image to tollbar button using VBA

I want to add an image to a toolbar button I created with VBA in MS Word 2003 with the following code:

Sub commandBarWithButton()

    Dim cbar As CommandBar
    Dim but As CommandBarButton
    Set cbar = CommandBars.Add("cBar", msoBarTop)
    cbar.Visible = True
    Set but = CommandBars("cBar").Controls.Add(msoControlButton)
    but.Visible = True
    With but
        .Caption = "Save"
        .Style = msoButtonCaption
    End With
End Sub

Which commands should I add to the above code?
Visual Basic ClassicMicrosoft Word

Avatar of undefined
Last Comment

8/22/2022 - Mon