VBA to log into a website

sitewolf

Active Member
Joined
May 4, 2012
Messages
304
I have a spread I use daily where I need to go to a series of links on a site and extract data- all that is programmed
But it's a site that requires I first be logged into my account.

Code:
Sub AcctLogin()

Dim a As String
    Set ie = CreateObject("InternetExplorer.Application")
    With ie
        .Visible = True
        .navigate "https://www.nobama.com"
        Do Until .readyState = 4
            DoEvents
        Loop
        .document.all.Item("j_username").Value = "username"
        .document.all.Item("j_password").Value = "password"
        .document.forms(0).submit
    End With
  End Sub

The above code works, but it opens up an IE window yada yada yada I'd just like it to log in in the background so I don't have to deal with a new window..

Is there a simple line I can add to this I'm not thinking of?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
What is .Visible for then if not to turn what I'm talking about on and off? Am I stuck with the new window thing?
 
Upvote 0
just realized, too, that there's no code to deal with things if I'm not already logged in.....which normally wouldn't be the case, but I'm trying to get this spread to the point the average Excel user can run it
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,583
Members
449,089
Latest member
Motoracer88

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