expression.Follow(NewWindow, AddHistory, ExtraInfo, Method, HeaderInfo)
expression Required. An expression that returns one of the objects in the Applies To list.
NewWindow Optional Boolean. A Boolean value where 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. A Boolean value where 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 Integer value that specifies how the extrainfo argument is attached. The method argument may be one of the following intrinsic constants.
MsoExtraInfoMethod can be one of these MsoExtraInfoMethod constants. |
msoMethodGet default. The extrainfo argument is appended to the hyperlink address and can only be a string. This value is passed by default. |
msoMethodPost. The extrainfo argument is posted, either as a string or as an array of type Byte. |
HeaderInfo Optional String. A string that specifies header information. By default the headerinfo argument is a zero-length string (" ").
Remarks
The Follow method has the same effect as clicking 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 web page 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 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 = "http://www.microsoft.com/"
.Hyperlink.Follow
End With
End Sub