Hyperlink.Follow method (Access)
The Follow method opens the document or webpage specified by a hyperlink address associated with a control on a form or report.
Syntax
expression.Follow (NewWindow, AddHistory, ExtraInfo, Method, HeaderInfo)
expression A variable that represents a Hyperlink object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
NewWindow | Optional | Boolean | True (1) opens the document in a new window and False (0) opens the document in the current window. The default is False. |
AddHistory | Optional | Boolean | True adds the hyperlink to the History folder and False doesn't add the hyperlink to the History folder. The default is True. |
ExtraInfo | Optional | Variant | A string or an array of Byte data that specifies additional information for navigating to a hyperlink. For example, this argument may be used to specify a search parameter for an .ASP or .IDC file. In your web browser, the ExtraInfo argument may appear after the hyperlink address, separated from the address by a question mark (?). You don't need to include the question mark when you specify the ExtraInfo argument. |
Method | Optional | MsoExtraInfoMethod | An MsoExtraInfoMethod constant that specifies how the ExtraInfo argument is attached. The default is msoMethodGet. |
HeaderInfo | Optional | String | Specifies header information. By default, the HeaderInfo argument is a zero-length string (" "). |
Remarks
The Follow method has the same effect as choosing a hyperlink.
You can include the Follow method in an event procedure if you want to open a hyperlink in response to a user action. For example, you may want to open a webpage with reference information when a user opens a particular form.
When you use the Follow method, you don't need to know the address specified by a control's HyperlinkAddress property. You only need to know the name of the control that contains the hyperlink. Conversely, when you use the FollowHyperlink method, you need to specify the address for the particular hyperlink that you wish to follow.
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 = "https://www.microsoft.com/"
.Hyperlink.Follow
End With
End Sub
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.