CommandBarButton.HyperlinkType Property (Office)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Sets or gets a MsoCommandBarButtonHyperlinkType constant that represents the type of hyperlink associated with the specified command bar button. Read/write.

Note Note

The use of CommandBars in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface. For more information, search Help for the keyword "ribbon."

expression .HyperlinkType

expression A variable that represents a CommandBarButton object.

This example checks the HyperlinkType property for the specified command bar button on the command bar named "Custom.". If HyperlinkType is set to msoCommandBarButtonHyperlinkNone, the example sets the property to msoCommandBarButtonHyperlinkOpen and sets the URL to

Set myBar = CommandBars _ 
    .Add(Name:="Custom", Position:=msoBarTop, _ 
Set myButton = myBar.Controls.Add(Type:=msoControlButton) 
With myButton 
    .FaceId = 277 
    .HyperlinkType = msoCommandBarButtonHyperlinkNone 
End With 
If myButton.HyperlinkType > _ 
    msoCommandBarButtonHyperlinkOpen Then 
    myButton.HyperlinkType = _ 
    myButton.TooltipText = "" 
End If