(Solved) – Clicking in a button using VBA (HREF)


Please, could you help me to click in a button using VBA? Im not dev, just trying to automate boring tasks.

The html is:


My code:

    Dim ie As New InternetExplorerMedium
    With ie
        .Visible = True
        .Navigate2 "MY SITE"

        While .Busy Or .ReadyState <> 4: DoEvents: Wend

        'find the textbox and fill value
        ie.Document.getElementById("LoginRpt_UserName").Value = "MY USER"
        ie.Document.getElementById("LoginRpt_Password").Value = "MY PASSWORD"

        'Click the button
        ie.Document.querySelector("a[href='THE HREF /']").Click

    End With
End Sub

Error message

Leave a Reply

Your email address will not be published. Required fields are marked *