Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Capture Web Page Source Code

I was trying to collect some real estate data from a website and found that I was unable to capture the source code using the usual techniques. For example,

my_url = "http://www.coloproperty.com/index.cfm?&Action=ShowFrameSet&GotoApp=Listings&Go toAction=DoAddressSearch&StreetName=Eisenhower&Cit y=61&ResultType=quickReport"

With ie
.Visible = True
.Navigate my_url
.Top = 50
.Left = 530
.Height = 400
.Width = 400

Do Until .ReadyState = 4
DoEvents
Loop
End With

my_var = ie.document.body.innerhtml

opens the desired web page but does not capture the source code. If I right-click the web page and select "View Source", I can see the source code I'd like to capture, but the variable contains just a few lines of something different. Any help on capturing the actual source code behind this web page would be much appreciated...TIA, Ron
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Capture Web Page Source Code

How about an external query? correct word wrap
MLS# Price SQFT Beds Baths Address Subdivision Locale Photo
Pano
672274 $279,900 1728 3 2 376 Eisenhower Dr Hunters Ridge
Louisville
665060 $499,000 3076 3 3 1806 Eisenhower Dr PONDEROSA
Louisville


On Feb 5, 9:36*am, " wrote:
I was trying to collect some real estate data from a website and found that I was unable to capture the source code using the usual techniques. *For example,

* my_url = "http://www.coloproperty.com/index.cfm?&Action=ShowFrameSet&GotoApp=Li..."

* With ie
* * * .Visible = True
* * * .Navigate my_url
* * * .Top = 50
* * * .Left = 530
* * * .Height = 400
* * * .Width = 400

* * Do Until .ReadyState = 4
* * * *DoEvents
* * Loop
* End With

* my_var = ie.document.body.innerhtml

opens the desired web page but does not capture the source code. *If I right-click the web page and select "View Source", I can see the source code I'd like to capture, but the variable contains just a few lines of something different. *Any help on capturing the actual source code behind this web page would be much appreciated...TIA, Ron


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Capture Web Page Source Code

Thanks Don, what code did you use? When I use

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & my_url, _
Destination:=Range("A1"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

nothing is imported into the activesheet. Also, do you know of anyway to capture the source code and not import anything directly into the workbook?..Ron
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Capture Web Page Source Code

On Feb 5, 11:59*am, " wrote:
Thanks Don, what code did you use? *When I use

* * With ActiveSheet.QueryTables.Add(Connection:= _
* * * "URL;" & my_url, _
* * * Destination:=Range("A1"))
* * * * .BackgroundQuery = True
* * * * .TablesOnlyFromHTML = False
* * * * .Refresh BackgroundQuery:=False
* * * * .SaveData = True
* * End With

nothing is imported into the activesheet. *Also, do you know of anyway to capture the source code and not import anything directly into the workbook?..Ron


I clicked on the urlit changed to which I used for the query.

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.coloproperty.com/Listings/index.cfm?
&Action=DoAddressSearch&ResultType=quickReport&Cit y=61&StreetName=Eisenhower"
_
, Destination:=Range("A5"))
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Capture Web Page Source Code

Don...Thanks for pointing that out. With your url, the information is not in a frame so I can simply use
my_var = ie.document.body.innerhtml

Better yet, I don't even need to open IE. With your url the "GET" method works just fine.
Set my_obj = CreateObject("MSXML2.XMLHTTP")
my_obj.Open "GET", my_url, False
my_obj.send
my_var = my_obj.responsetext
Set my_obj = Nothing

....Ron


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Capture Web Page Source Code

For anyone who follows, turns out the info I wanted was in a frame and

my_var = my_var = ie.Document.frames("content").Document.DocumentEle ment.innerhtml

does the trick.

Thanks again to Don...Ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting the source code of a web page Southern at Heart Excel Programming 6 January 18th 10 05:58 AM
CAPTURE INFO FROM PAGE TO PAGE Jenny Excel Discussion (Misc queries) 1 June 23rd 09 09:28 PM
Capture the Source Address of copied data D Riggins Excel Programming 1 November 13th 08 06:17 PM
Importing Web Page Source Code tx12345[_6_] Excel Programming 5 January 22nd 06 12:16 AM
Viewing source code when saved as web page Mark Excel Discussion (Misc queries) 1 March 31st 05 06:26 AM


All times are GMT +1. The time now is 09:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"