Below is the login for the N Power Website. Change the UserName and
Password as required. It took me a long time to learn all the ticks of
downloading webpages into excel. If you do a google search for the
string below you will find lots of my examples from Microsoft and
TheCodeCage Postings.
Joel Excel VBA IE
Sub NPowerLogin()
MyUserName = "UserName"
MyPassword = "Password"
URL = "https://business.npower.com/myaccount/login.aspx"
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
'get web page
IE.Navigate2 URL
Do While IE.readystate < 4 Or _
IE.busy = True
DoEvents
Loop
Set UserName = IE.document.getelementbyid("txtUsername")
'check if already login, Username object wouldn't exist if loggin
If Not UserName Is Nothing Then
UserName.Value = MyUserName
Set Password = IE.document.getelementbyid("txtPassword")
Password.Value = MyPassword
Set Form = IE.document.getelementsbytagname("Form")
Form(0).submit
'wait for login
Do While IE.readystate < 4 Or _
IE.busy = True
DoEvents
Loop
MsgBox ("Logged In")
End If
IE.Quit
End Sub
--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=161675
Microsoft Office Help