PDA

View Full Version : VBA Code For Web Login Not Working



Fjek54kzq3T
01-13-2013, 08:47 PM
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 :dunno

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. :dunno

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

mikerickson
01-18-2013, 09:04 PM
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
your code

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.