Home > Forum Home > Analyzing Corporate Financial Data > Macro that will automatically log me into web application > here is what i already have Share

Here is what i already have

Excel Help for Here Is What I Already Have in Analyzing Corporate Financial Data


Forum TopicLogin

Here Is What I Already Have

Rate this:
(3/5 from 2 votes)
Confusedthis is what I have, it populates the username and password fine but it will not log in.

VBA Code:
Public Sub Eco()
    Const strURL_c As String = "[http://www.btwholesale.com/]"
    Dim objIE As SHDocVw.InternetExplorer
    Dim ieDoc As MSHTML.HTMLDocument
    Dim tbxPwdFld As MSHTML.HTMLInputElement
    Dim tbxUsrFld As MSHTML.HTMLInputElement
    Dim btnSubmit As MSHTML.HTMLInputElement
    On Error GoTo Err_Hnd
     'Create Internet Explorer Object
    Set objIE = New SHDocVw.InternetExplorer
     'Navigate the URL
    objIE.navigate strURL_c
     'Wait for page to load
    Do Until objIE.readyState = READYSTATE_COMPLETE: Loop
         'Get document object
        Set ieDoc = objIE.document
         'Get username/password fields and submit button.
        Set tbxUsrFld = ieDoc.all.Item("USER")
        Set tbxPwdFld = ieDoc.all.Item("PASSWORD")
        Set btnSubmit = ieDoc.all.Item("LOGIN")
         'Fill Fields
        tbxUsrFld.Value = Worksheets("Login Data").Range("C5").Value
        tbxPwdFld.Value = Worksheets("Login Data").Range("D5").Value
         'Click submit
        btnSubmit.Click
         'Wait for page to load
        Do Until objIE.readyState = READYSTATE_COMPLETE: Loop
Err_Hnd: '(Fail gracefully)
            objIE.Visible = True
        End Sub
 Posted by on
 
View Full Post

Excel templates and solutions matched for here is what i already have:

Solutions: Detect Spreadsheet Differences