VBA - IE Login

mtharnden

Board Regular
Joined
Aug 17, 2011
Messages
114
Ok, this SHOULD be easy, and i have done this before but not getting it working right now

i need to try and do this without saying what webpage it is but the page may be my issue...

ive tried a few different ways and getting an error any time i try and enter into the form. i want to use a getElementByID (or Name) method


error i get:
Run-time '91'
Object Variable or with black variable not set

i do have the following references set:
Microsoft HTML Object Library
Microsoft Internet Controls

what i have so far:
Code:
    Dim objIExplorer As Object
    
    Set objIExplorer = CreateObject("InternetExplorer.Application")

    objIExplorer.Silent = True
    objIExplorer.Visible = True
    
    objIExplorer.navigate "http://URL.net/"
    Do While objIExplorer.Busy Or Not objIExplorer.readyState = 4: DoEvents: Loop
    objIExplorer.document.getElementById("userLogin").Value = "USERNAME"
    objIExplorer.document.getElementById("password").Value = "PASSWORD"
    x = objIExplorer.document.getElementById("submitButton").sourceIndex
    objIExplorer.document.all.Item(x).Click
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
it wont let me post the HTML for some reason, not sure how to do that correctly here...

-here is the first line for the form
body class="loginForm" ******="init();"

-here is the line showing userLogin
input name="userLogin" onkeydown="validateForm();" onpropertychange="validateForm();" onblur="validateForm();" size="20" type="text"
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,977
Members
449,200
Latest member
Jamil ahmed

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