+ Reply to Thread
Results 1 to 13 of 13

Logging in to website using VBA, input fields have no ID

Hybrid View

esvenk Logging in to website using... 10-09-2013, 06:47 PM
Norie Re: Logging in to website... 10-09-2013, 06:53 PM
esvenk Re: Logging in to website... 10-09-2013, 07:11 PM
Chippy Re: Logging in to website... 10-09-2013, 07:00 PM
esvenk Re: Logging in to website... 10-09-2013, 07:15 PM
Norie Re: Logging in to website... 10-09-2013, 07:20 PM
esvenk Re: Logging in to website... 10-09-2013, 07:49 PM
Norie Re: Logging in to website... 10-09-2013, 08:02 PM
esvenk Re: Logging in to website... 10-09-2013, 08:07 PM
Norie Re: Logging in to website... 10-09-2013, 08:12 PM
Chippy Re: Logging in to website... 10-09-2013, 08:18 PM
Norie Re: Logging in to website... 10-09-2013, 08:48 PM
esvenk Re: Logging in to website... 10-10-2013, 12:51 PM
  1. #1
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Logging in to website using VBA, input fields have no ID

    What exactly did you try?
    If posting code please use code tags, see here.

  2. #2
    Registered User
    Join Date
    09-16-2013
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Logging in to website using VBA, input fields have no ID

    I tried your guys' suggestions. I suppose searching for how to use VBA with javascript code would do the trick, as that seems to be what the site is using for its text fields.

    Sub ExpenseReportLogin()
    
        If IsEmpty(Range("A1")) Then
        Range("E1").Value = "Error: Fill In the username field!"
        End If
            If IsEmpty(Range("A2")) Then
        Range("E2").Value = "Error: Fill In the password field!"
        End If
    
        Dim MyHTML_Element As IHTMLElement
        Dim MyURL As String
        On Error GoTo Err_Clear
        MyURL = "bigURL"
        Set MyBrowser = New InternetExplorer
        MyBrowser.Silent = True
        MyBrowser.navigate MyURL
        MyBrowser.Visible = True
    
        Do
        Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
        Set HTMLdoc = MyBrowser.document
        
        ' get reference to first form on page
        'Set frm = HTMLdoc.forms(1)
        
        'frm.all("USER").Value = "USER"
        'frm.all("PASSWORD").Value = "PWORD"
        'frm.submit
        
        HTMLdoc.Login.Password.Value = "MyAwesomePassword"
        
        'HTMLdoc.getElementsByName("USER")(0).Value = "USRNAME"
        'HTMLdoc.all.Password.Value = Range("A2")
        'Range("A1:A2").ClearContents
        'For Each MyHTML_Element In HTMLdoc.getElementsByTagName("input")
        'If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click: Exit For
        'Next
        
    Err_Clear:
        If Err <> 0 Then
        Err.Clear
        Resume Next
        End If
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Logging in to a website using Excel
    By FRIEL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2011, 11:08 AM
  2. Excel - Logging on to a website
    By jsomer2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2011, 12:55 PM
  3. Logging in a website with Macros
    By pink in forum Excel General
    Replies: 2
    Last Post: 12-14-2008, 07:24 PM
  4. [SOLVED] Logging a website information.
    By Nneuromancer in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-18-2006, 08:25 AM
  5. Logging into a website
    By Jackblack1 in forum Excel General
    Replies: 0
    Last Post: 05-31-2006, 12:27 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1