Table of contents
TOC
Collapse the table of content
Expand the table of content

Application.FollowHyperlink Method (Access)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

The FollowHyperlink method opens the document or Web page specified by a hyperlink address.

Syntax

expression. FollowHyperlink( ** Address, ** SubAddress, ** NewWindow, ** AddHistory, ** ExtraInfo, ** Method, ** HeaderInfo** )

expression A variable that represents an Application object.

Parameters

NameRequired/OptionalData TypeDescription
AddressRequiredStringA string expression that evaluates to a valid hyperlink address.
SubAddressOptionalStringA string expression that evaluates to a named location in the document specified by the address argument. The default is a zero-length string (" ").
NewWindowOptionalBooleanA 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.
AddHistoryOptionalBooleanA 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.
ExtraInfoOptionalVariantA 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.
MethodOptionalMsoExtraInfoMethodA MsoExtraInfoMethod constant that specifies how the extrainfo argument is attached.
HeaderInfoOptionalStringA string that specifies header information. By default the headerinfo argument is a zero-length string.

Remarks

By using the FollowHyperlink method, you can follow a hyperlink that doesn't exist in a control. This hyperlink may be supplied by you or by the user. For example, you can prompt a user to enter a hyperlink address in a dialog box, then use the FollowHyperlink method to follow that hyperlink.

You can use the extrainfo and method arguments to supply additional information when navigating to a hyperlink. For example, you can supply parameters to a search engine.

You can use the Follow method to follow a hyperlink associated with a control.

Example

The following function prompts a user for a hyperlink address and then follows the hyperlink:

Function GetUserAddress() As Boolean 
    Dim strInput As String 

    On Error GoTo Error_GetUserAddress 
    strInput = InputBox("Enter a valid address") 
    Application.FollowHyperlink strInput, , True 
    GetUserAddress = True 

Exit_GetUserAddress: 
    Exit Function 

Error_GetUserAddress: 
    MsgBox Err &; ": " &; Err.Description 
    GetUserAddress = False 
    Resume Exit_GetUserAddress 
End Function

You could call this function with a procedure such as the following:

Sub CallGetUserAddress() 
    If GetUserAddress = True Then 
        MsgBox "Successfully followed hyperlink." 
    Else 
        MsgBox "Could not follow hyperlink." 
    End If 
End Sub

See also

Concepts

Application Object

© 2017 Microsoft