CommandBarButton.HyperlinkType property (Office)

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

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, see Overview of the Office Fluent ribbon.

Syntax

expression.HyperlinkType

expression A variable that represents a CommandBarButton object.

Example

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 www.microsoft.com.

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

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.