Access/VBA Library

followLink Method

Select a hyperlink using its caption and perform a 'click' on this element. All hyperlinks (tagname 'a') are searched on the current webpage and scanned. The number of searched links can be reduced by specifying a classname.

Syntax

clsIE.followLink( caption [, className] )
Parameters
Name Type Description
clsIE   The name of an object of type clsIE
caption String Required. The caption or innerText of a hyperlink.
className String Optional. The name of the CSS-class the hyperlink should contain.
Default: ""
Return value

Boolean : True when a hyperlink has been found and clicked, False otherwise.

clsIEtag:clsIE

Remarks

  • When multiple hyperlinks matches the given criteria, only the first one will be selected.
Example
  ' Get the Weather foracast of BBC
  Dim IE As New clsIE

  IE.location = "https://www.bbc.com/"
  If IE.FollowLink("Weather") Then
      MsgBox "See website for Weather forecast!"
  Else
      MsgBox "No Weather forecast today:)!"
  End If