Access/VBA Library

getElement Method

Returns the first element on the current webpage matching the given CSS-selector.

See also:


clsIE.getElement( cssSelector )
Name Type Description
clsIE   The name of an object of type clsIE
cssSelector String Required. Pattern to select an element on the current webpage.
Return value

IHTMLElement : The element selected. When not found an Nothing is returned.

Dim IE As New clsIE
Dim Element as IHTMLElement
IE.location = ""
' Get the element "Learn HTML" in the side navigation
Set Element = IE.getElement("#mySidenav a.w3-bar-item")
If Not (Element Is Nothing) Then
    ' Click the element selected
End if