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

(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:

Relatórios

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.getElementsByName("LoginRpt$LoginButton")(0).Click
        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 *