Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default getting the source code of a web page

I now got the GPS locations. It was buried in the webpage at a spot I didn't
check.

Sub GetAddress()

Dim Latitude As String
Dim Longitude As String


Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

URL = "http://www.ymca.net/maps/profile.aspx?assn=6757"

'get web page
IE.Navigate2 URL
Do While IE.readyState < 4 Or _
IE.Busy = True
DoEvents
Loop
'Call Dump(IE)



Set Title = IE.document.getElementsByTagName("Title")
YName = Title.Item(0).innertext
MsgBox (YName)


Set P = IE.document.getElementsByTagName("p")
Address = P.Item(1).innertext
MsgBox (Address)

Set Scripts = IE.document.getElementsByTagName("Script")
RowCount = 1
For Each Script In Scripts
If InStr(Script.outerHTML, "GLatLng") 0 Then
GLatLngStart = InStr(Script.outerHTML, "GLatLng")
GLatLng = Mid(Script.outerHTML, GLatLngStart)
'remove parenthisis
GLatLngStart = InStr(GLatLng, "(")
GLatLng = Mid(GLatLng, GLatLngStart + 1)

GLatLngEnd = InStr(GLatLng, ")")
GLatLng = Left(GLatLng, GLatLngEnd - 1)

GPS = Split(GLatLng, ",")
MsgBox ("Latitude : " & GPS(0) & vbCrLf & "Longitude : " & GPS(1))

Exit For

End If
RowCount = RowCount + 1
Next Script

IE.Quit


End Sub
Sub Dump(IE)
RowCount = 1
Cells.ClearContents
For Each itm In IE.document.all
Range("A" & RowCount) = itm.tagName
Range("B" & RowCount) = itm.ID
Range("C" & RowCount) = itm.className
Range("D" & RowCount) = Left(itm.innertext, 1024)

RowCount = RowCount + 1
Next itm

End Sub


"Joel" wrote:

IO got the address. I'm not sue if I can get the GPS address from here. the
zip code is passed to an activex utility and I don't think that is available
at this URL. To get the URL there is probably a Google utility that will do
thhis. I would have to look for it. Never tried it before.

Sub GetAddress()


Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

URL = "http://www.ymca.net/maps/profile.aspx?assn=6757"

'get web page
IE.Navigate2 URL
Do While IE.readyState < 4 Or _
IE.Busy = True
DoEvents
Loop
Call Dump(IE)


a = 1
Set Title = IE.document.getElementsByTagName("Title")
YName = Title.Item(0).innertext
MsgBox (YName)
Set P = IE.document.getElementsByTagName("p")
Address = P.Item(1).innertext
MsgBox (Address)

IE.Quit


End Sub
Sub Dump(IE)
RowCount = 1
Cells.ClearContents
For Each itm In IE.document.all
Range("A" & RowCount) = itm.tagName
Range("B" & RowCount) = itm.ID
Range("C" & RowCount) = itm.className
Range("D" & RowCount) = Left(itm.innertext, 1024)

RowCount = RowCount + 1
Next itm

End Sub



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
creating drop down lists from source on another page Shaun Excel Worksheet Functions 7 March 12th 10 07:37 PM
Get address from iFrame reference in page source [email protected] Excel Programming 11 September 15th 08 07:48 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
Get source from a web page into a worksheet [email protected] Excel Programming 1 July 30th 04 03:17 PM


All times are GMT +1. The time now is 05:00 AM.

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"