Consulting

Results 1 to 2 of 2

Thread: VBA Code For Web Login Not Working

  1. #1

    VBA Code For Web Login Not Working

    I really do appreciate any help someone can offer. I am using a macro in excel to access accounts on the web. I have over 30 accounts and it's very tedious. I have been successful with many of the sites but I am having problems with these 2. I had to remove one W for www so I could post this. I apparently can't post links for some reason.

    1) This one inputs the username but will not click "Logon". I am pretty sure the ID is "BBT-LOGON" but its errors at that line. I have tried many other ID's as well like "logon" and others. I don't understand

    [VBA]Dim objIE As InternetExplorer
    Public Sub bbt()

    Set objIE = CreateObject("InternetExplorer.Application")

    objIE.Silent = True

    objIE.Top = 0
    objIE.Left = 825
    objIE.Height = 1075
    objIE.Width = 1100

    objIE.Visible = True

    objIE.navigate "ww.bbt.com"

    Do While objIE.Busy Or Not objIE.readyState = 4: DoEvents: Loop

    objIE.Document.getelementbyid("usernamefield").Value = "username"
    objIE.Document.all.Item("bbt-logon").Click

    End Sub

    2) This code skips the username field inputs the password and hits enter. The ID is UserID. Its right on the source code.

    Dim objIE As InternetExplorer
    Public Sub ae()

    Set objIE = CreateObject("InternetExplorer.Application")

    objIE.Silent = True

    objIE.Top = 0
    objIE.Left = 825
    objIE.Height = 1075
    objIE.Width = 1100

    objIE.Visible = True

    objIE.navigate "ww.americanexpress.com"

    Do While objIE.Busy Or Not objIE.readyState = 4: DoEvents: Loop

    objIE.Document.getelementbyid("userid").Value = "username"
    objIE.Document.getelementbyid("password").Value = "password"
    objIE.Document.getelementbyid("loginimage").Click


    End Sub[/VBA]
    Last edited by mikerickson; 01-18-2013 at 09:04 PM.

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,776
    Welcome to the forum.

    We require that all code be wrapped in code tags.
    You can either select the code and press the VBA button above the editor window or type the tags in manualy
    [VBA] your code [/VBA]

    I'll do it for you this time.
    I'm also moving your question to the general forum since it seems to not be related to a Mac.

Posting Permissions

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