Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
creating drop down lists from source on another page | Excel Worksheet Functions | |||
Get address from iFrame reference in page source | Excel Programming | |||
Importing Web Page Source Code | Excel Programming | |||
Viewing source code when saved as web page | Excel Discussion (Misc queries) | |||
Get source from a web page into a worksheet | Excel Programming |