FollowHyperlink Method 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