Skip to content Skip to sidebar Skip to footer

Vba To Click Web Button With Dynamic Elementid And Repetitive Class

I am quite new to VBA/html, trying to automate filling a form, but cannot even call it ... I searched the web for weeks tried many different code combinations, but none got me ther

Solution 1:

Try the following code. It is hard to give any solution without playing with that site. They are always hypothetical.

Sub GetClick()
    Dim IE AsNew InternetExplorer, Html As HTMLDocument

    With IE
        .Visible =True
        .Navigate "https://company.application.com/home/index.cfm?Tab=home"
        While .Busy =TrueOr .ReadyState <4: DoEvents: Wend
        Set Html = .Document
    EndWith''If the problem still persists, make sure to put here some delay

    Html.querySelector(".clickable[id^='ext-eng']").Click
End Sub

Another approach might be something like (if the word "Text" didn't appear anywhere with the same class name):

ForEach elem In Html.getElementsByClassName("clickable")
    If InStr(elem.innerText, "Text") > 0Then elem.Click: ExitForNext elem

Reference to add:

Microsoft Internet Controls
Microsoft HTMLObject Library

Post a Comment for "Vba To Click Web Button With Dynamic Elementid And Repetitive Class"