View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 118
Default Stuck at Trying to Extract Data from a Website using JSP

On Jul 27, 9:38*am, ron wrote:
On Jul 26, 8:24*pm, "Herbert Chan" wrote...snip...

Now that a way is found, I just wonder if there is a more elegant way to get
to the data.


HC...I agree it is not a very elegant approach. *Opening IE and moving
from url to url takes time. *I prefer to use the GET method whenever
possible as it does not require IE to be open. *I have a macro that
checks real estate data at 800 different addresses. *Using IE to move
from page to page, the maco takes 45 minutes to run; using the GET
method and parsing the source code behind each web page that is
assigned to a variable only requires 14 minutes. *However when I tried
the GET method with the url I used above, the source code did not
contain the pop-up box information.

* * my_url = "http://proptx.midland.com.hk/unit/index.jsp?
est_id=E00005&unit_id=U000146982"
* * Set my_object = CreateObject("MSXML2.XMLHTTP")
* * my_object.Open "GET", my_url, False
* * my_object.send
* * my_var = RL.responsetext
* * Set my_object = Nothing

An alternative would be to still run IE, scrape the data to the
clipboard, then, rather than paste the data into a spreadsheet, the
clipboard contents can be transferred to a variable which could then
be parsed (instr, mid, left, etc.) and the desired information
extracted. *I have tried this method and it works for the flats on the
web page.

Set my_object = CreateObject("htmlfile")
my_var = my_object.ParentWindow.ClipboardData.GetData("text ")

...Ron


PS...to use the clipboard transfer method the Microsoft Forms 2.0
Object Library must be selected...Ron