VBA to log into a website

sitewolf

Active Member
Joined
May 4, 2012
Messages
289
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?
 

Some videos you may like

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

sitewolf

Active Member
Joined
May 4, 2012
Messages
289
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?
 

sitewolf

Active Member
Joined
May 4, 2012
Messages
289
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
 

Watch MrExcel Video

Forum statistics

Threads
1,119,249
Messages
5,576,944
Members
412,753
Latest member
Coach_Olson
Top