AddToFavorites Method

Applies To

Application object, Command Button control.

Description

The AddToFavorites method adds a hyperlink address to the Favorites folder.

Syntax

object.hyperlink.AddToFavorites

The AddToFavorites method has the following arguments.

Argument

Description

object

The Application object, or a Control object that contains a hyperlink. Label, command button, and image controls can contain hyperlinks.

hyperlink

The hyperlink of the Control object.


Remarks

When applied to the Application object, the AddToFavorites method adds the name of the current database to the Favorites folder. For example, if you're working in the Northwind sample database, applying the AddToFavorites method to the Application object adds the hyperlink address of the Northwind database to the Favorites folder.

When applied to a Control object, the AddToFavorites method adds the hyperlink address contained in a control to the Favorites folder. The Favorites folder is installed in the Windows folder by default.

The AddToFavorites method has the same effect as clicking AddToFavorites on the Favorites menu on the Web toolbar when the document whose address you wish to add is open.

See Also

Follow method, FollowHyperlink 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