PDA

View Full Version : Accessing Web page from Excel



Richard Smit
05-14-2008, 04:27 AM
Hello there,

This was of great help, I've modified accordingly and its excellent. Thank you very much for your support.

I hope you can help me with this as well.

I use the following code to access a web page from excel

Sub Chats1()
Dim ieApp As InternetExplorer
Dim iePage As HTMLDocument
Set ieApp = New InternetExplorer
ieApp.Visible = True
ieApp.Navigate Range("F4").Value
'wait for page to load
Do Until ieApp.ReadyState = READYSTATE_COMPLETE
Loop
Set iePage = ieApp.Document
iePage.Forms(0).Item("site").Value = Range("B1").Value
iePage.Forms(0).Item("user").Value = Range("B2").Value
iePage.Forms(0).Item("pass").Value = Range("B3").Value
iePage.Forms(0).Item("submit").Click

End Sub
However,... If the web site is already open the site does not have to login as you can see the parameters mentioned here helps me to login automatically.

"iePage.Forms(0).Item("site").Value = Range("B1").Value
iePage.Forms(0).Item("user").Value = Range("B2").Value
iePage.Forms(0).Item("pass").Value = Range("B3").Value
iePage.Forms(0).Item("submit").Click"

I was wondering if you can help with this so that if the site is already open the system will not have to login.

Looking forward to your help and thank you for your support always.

Regards,
Richard


Post moved to it's own thread as it is a new problem.
~Oorang

akanchu
05-15-2008, 06:32 PM
Not sure if this will help :dunno, but is there a possibility that URL would change after you login.
So you can check what the URL is by using .LocationURL variable of ieapp in your case. If it is the login page then use the code of passing values else perform something else..