PDA

View Full Version : Solved: Log on to a password protected website to view info



Digita
04-08-2008, 12:30 AM
G'day,

I'm struggling on a VBA problem and I need your help please. I'd like to automate the process of logging into a web page - https://www.investoronline.info/ and input account number and PIN. Perusal of the source code of the above web page, the login variables are: accountNumber & pin.

After doing some googling, I modified a sample code found in

http://www.business-spreadsheets.com/forum.asp?t=103

The following code does not report any errors. However, it did not give me what I need either.

Sub Login_WebQuery()
Dim MyPost As String
Const MyUrl As String = "http://www.investoronline.info/"
Const PostUser As String = "accountNumber=xxxx" 'Account ID to be input here
Const PostPassword As String = "&pin=xxxx" 'Change password here

MyPost = PostUser & PostPassword

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & MyUrl, Destination:=Cells(1, 1))
.PostText = MyPost
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = True
End With

End Sub

Any suggestions?

Thanks in advance.

Regards


kp

mdmackillop
04-08-2008, 11:16 AM
How about this version (http://www.vbaexpress.com/kb/getarticle.php?kb_id=973)?

Digita
04-08-2008, 03:48 PM
Hi Md

Brilliant. Thanks for the link. Also thanks to Oorang for the magic script. I won't be anywhere without you guys.

Regards


kp