Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata
 Dim TagNameStr As String, InnerTextStr As String
 Dim IEElmObj As MSHTML.HTMLGenericElement

 TagNameStr = "span"
 InnerTextStr = "PRINT"
 Set IEElmObj = FindIEElementByTagNameandInnerText(IEObj.document, TagNameStr, InnerTextStr)
 IEElmObj.Click
Public Function FindIEElementByTagNameandInnerText(ByRef doc As HTMLDocument, TagNameStr As String, InnerTextStr As String) As MSHTML.HTMLGenericElement
 Dim HTMLColl As MSHTML.IHTMLElementCollection
 Dim IEElmObj As MSHTML.HTMLGenericElement

 Set HTMLColl = IEObj.document.getElementsByTagName(TagNameStr)
 For Each IEElmObj In HTMLColl
  If InStr(IEElmObj.innerText, InnerTextStr) > 0 Then
   Set FindIEElementByTagNameandInnerText = IEElmObj
   Exit For
  End If
 Next
End Function
  • No labels