View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
George Z George Z is offline
external usenet poster
 
Posts: 2
Default Excel - Access Web Page

Hi Judith,

Below is a function I used once to show that VBA could do a HTTP post to a
site.

You will need to customise it to login to your website though (included a
test to show how it is called):

Function searchPost(ByVal strNumber As String, ByVal strName As String, _
ByVal strSuburb As String, ByVal strState As String)
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
On Error GoTo errHandler
With ie
.navigate "http://www.whereis.com/whereis/map.do"
Do While .busy: DoEvents: Loop
Do While .ReadyState < 4: DoEvents: Loop
With .document.Forms(1)
.addressStreetNo1.Value = strNumber
.addressStreetName1.Value = strName
.addressSuburb1.Value = strSuburb
.addressState1.Value = strState
.submit
End With

Do While .busy: DoEvents: Loop
Do While .ReadyState < 4: DoEvents: Loop
.Visible = True

End With
Exit Function
errHandler:
ie.Quit: Set ie = Nothing
End Function

Sub testSearchAUPost()
searchPost "101", "Collins Street", "Melbourne", "Victoria"
End Sub

Note that the HTTP Document form objects are hardcoded, in your case, you
would locate the username/password form fields to place into the script.

Hope this helps

"judith" wrote:

I regularly access some web pages - I want to do so via VBA.

I must access them via a log-in page - I can then access all other
pages on the site.

I have opened the initial web page in my browser and logged in. I
then open second page from within VBA but instead of going to called
page it goes to log-in page.

How can I log-in via VBA - keep web session active (if that is correct
terminology) and then access other pages?