AddToFavorites Method Example

The following example sets the HyperlinkAddress property of a command button. When the user clicks the command button, the address is added to the Favorites folder by using the AddToFavorites method.

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

Private Sub Form_Load()
    Me!Command0.HyperlinkAddress = "http://www.microsoft.com/"
End Sub
Private Sub Command0_Click()
    Me!Command0.Hyperlink.AddToFavorites
End Sub