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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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,882
Messages
6,127,535
Members
449,385
Latest member
KMGLarson

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