VBA Code to login into a Website

freedive619

New Member
Joined
Dec 11, 2017
Messages
2
Hello,

I am having problems logging into a Wells Fargo website. I've tried using codes from this forum but I cannot get my info to entered into the boxes. This is the website and the code i am using...

Option Explicit
Const MyUserID As String = "123701"
Const MyUserName As String = "sdf12345"
Const MyPassword As String = "Tuna2017"
Const READYSTATE_COMPLETE As Integer = 4
Dim objIE As Object
Public Sub LoginScript()

Set objIE = CreateObject("InternetExplorer.Application")

With objIE
.Visible = True
.Silent = True
.navigate ("https://wffnet.wellsfargo.com/ilonline/funding/wff_landingPageFrameSet.jsp")
Do Until .readyState = READYSTATE_COMPLETE
DoEvents
Loop
Application.Wait Now() + TimeValue("00:00:02")
.document.all.MyUserId.Value= MyUserID
.document.all.UserId.Value = MyUserName
.document.all.userLoginPassword.Value = MyPassword
.document.forms(0).submit
Do Until .readyState = READYSTATE_COMPLETE
DoEvents
Loop
Application.Wait Now() + TimeValue("00:00:02")
End With
End Sub

The code works perfectly until it reached the lower half. It's stating it's missing an object. Anyone know how this can be altered?

.document.all.MyUserId.Value= MyUserID
.document.all.UserId.Value = MyUserName
.document.all.userLoginPassword.Value = MyPassword
.document.forms(0).submit


Thanks!!!!!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
The web page uses frames so you need to reference the elements within the "Body" frame document.

Code:
Public Sub IE_Login()

    Dim IE As Object
    Dim HTMLdoc As Object
    
    Set IE = CreateObject("InternetExplorer.Application")
    With IE
        .Visible = True
        .navigate "https://wffnet.wellsfargo.com/ilonline/funding/wff_landingPageFrameSet.jsp"
        While .Busy Or .readyState <> 4: DoEvents: Wend
        Set HTMLdoc = .document.getElementsByTagName("frame")(1).contentDocument  'Body frame
    End With
    
    HTMLdoc.getElementById("so_companyId").Value = MyUserID
    HTMLdoc.getElementById("so_userId").Value = MyUserName
    HTMLdoc.getElementById("so_userLoginPassword").Value = MyPassword
    HTMLdoc.getElementById("so_userLoginGoButton").Click
    
    With IE
        While .Busy Or .readyState <> 4: DoEvents: Wend
    End With
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,742
Messages
6,126,611
Members
449,321
Latest member
syzer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top