Follow Method Example

The following example sets the HyperlinkAddress property of a command button and then opens the hyperlink when the form is loaded.

To try this example, create a form and add a command button named Command0. Paste the following code into the form's module and switch to Form view:

Private Sub Form_Load()
    Dim ctl As CommandButton

    Set ctl = Me!Command0
    With ctl
        .Visible = False
        .HyperlinkAddress = "http://www.microsoft.com/"
        .Hyperlink.Follow
    End With
End Sub