Javascript automatic login using VBA

Alphakx

New Member
Joined
Dec 29, 2013
Messages
3
Hi,

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!
 

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,069
Nothing to do the JavaScript. That page uses frames so you need to access the frame document, like this:
Code:
Sub x()

    With CreateObject("InternetExplorer.Application")
        .Visible = True
        .navigate "http://www.rexel.be/NS600/servlet/be.rex.ns.cf.RexStartServlet?Language=NL&~CHARSET=UTF-8"
        While .busy Or .readystate <> 4: DoEvents: Wend
        With .document.frames(0).document
            .getElementsByName("User")(0).Value = "username"
            .getElementsByName("Password")(0).Value = "password"
            .getElementsByName("ACTION_SIGNON")(0).Click
        End With
    End With
    
End Sub
 

Alphakx

New Member
Joined
Dec 29, 2013
Messages
3
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!
 

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,069
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?
 

Alphakx

New Member
Joined
Dec 29, 2013
Messages
3
This line causes the error:
Code:
With .document.frames(0).document
Maybe I miss an extension/plugin?
 

Forum statistics

Threads
1,085,968
Messages
5,387,053
Members
402,032
Latest member
kylaanderson83

Some videos you may like

This Week's Hot Topics

Top