Javascript automatic login using VBA


New Member

I'm trying to use VBA to login to this website: NetStore
I started using this tutorial: Daily Dose of Excel » Blog Archive » Get Data from Website that Requires a Login
but I wasn't able to fill in the username/pasword or to use VBA to click the submit button.
I also tried to use this tutorial: How to Login into Website Automatically Using VBA - YouTube which worked great for gmail but not for the site that i want.
So I think I will need some help from one of you guys... Can anybody give me some advice to get started?

Thanks in advance!


MrExcel MVP
Nothing to do the JavaScript. That page uses frames so you need to access the frame document, like this:
Sub x()

    With CreateObject("InternetExplorer.Application")
        .Visible = True
        .navigate ""
        While .busy Or .readystate <> 4: DoEvents: Wend
        With .document.frames(0).document
            .getElementsByName("User")(0).Value = "username"
            .getElementsByName("Password")(0).Value = "password"
        End With
    End With
End Sub


New Member
Thank you!
Guess we're getting close, but I'm getting an error saying "Error -2147352319 (80020101), Automation error"
Did I miss anything?

Thanks alot!


MrExcel MVP
That code is all you should need. It works for me on IE8 and XP. Which line (highlighted in yellow when you run the code) causes the error?

Some videos you may like

This Week's Hot Topics

  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • find many based on a certain criteria
    good evening, I hope someone can help me? I have a workbook sheet 2 contains lots of data.... I would like to be able to find anything on sheet...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...
  • Text Format
    I have a sheet for user to keyin the data. The format of the data can be 451 / 1903, 0012 / 9908 or 00287 / 0099. The number after the "/" is...
  • Macro to copy values across rows and transposing them and add the user id
    [FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][FONT=Calibri][SIZE=3][COLOR=#000000]Hi,[/COLOR][/SIZE][/FONT] [FONT=Times New...