View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Paul Martin[_2_] Paul Martin[_2_] is offline
external usenet poster
 
Posts: 133
Default Capture values from a web page drop-down list

This is what I have so far:

Dim HttpReq As New MSXML2.XMLHTTP
Dim HtmlDoc As New MSHTML.HTMLDocument

HttpReq.Open "GET", HTTP_PATH, False
HttpReq.send

Debug.Print HttpReq.Status

If HttpReq.Status = HTTPREQ_SUCCESS Then
HtmlDoc.body.innerHTML = HttpReq.responseText
End If

What I would like to know is if at this point in the code, HtmlDoc is
a variable representation of the webpage or whether it remains empty
until I 'navigate' to the URL.

I seem to be able to capture a form, as the following works:
Debug.Print HtmlDoc.forms("aspnetForm").Name

But the following fails (the item is the name of the drop-down list) &
I get Run-time error '91': Object variable or With block variable not
set:
Debug.Print HtmlDoc.forms("aspnetForm").Item
("ctl00$ContentPlaceHolder1$dpRecentReport").Na me

Any suggestions?


I have been unsuccessful in capturingdrop-down list from the web
page, eg, the following fails:

Debug.Print HtmlDoc.forms("aspnetForm").Name