Trouble filling Website Textbox for Login RRS feed

  • Question

  • Hey guys,

    I'm trying to fill two textboxes in order to login into a website (http://www.lpclatina.com.br) using VBA, but i'm not succeeding...

    This is the code trying to fill the first textbox:

        Dim ie As InternetExplorer
        Dim userBox As IHTMLElement
        Dim inputs As IHTMLElementCollection
        Dim doc As HTMLDocument
        Set ie = New InternetExplorer
        With ie
            .Navigate "http://www.lpclatina.com.br"
            .Visible = True
        End With
        Do While ie.Busy: DoEvents: Loop
        Do Until ie.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
        Set doc = ie.Document
        With doc
            Set inputs = .getElementsByName("user")
        End With
        Set userBox = inputs(0)

    And when I try to fill the textbox:

        userBox.Value = "username"

    I get the error msg:

    Run-time error '91' object variable or with block variable not set

    Could you help me?

    Tiago Castelani

    Thursday, October 31, 2013 2:23 AM

All replies

  • Hi,

    Thank you for posting in the MSDN Forum.

    Since the issue is more relate to the feature of VBA instead of MS Office development, I'd like to move it to VBA forum.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thanks for your understanding.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 1, 2013 1:59 AM