secondyankee
New member
- Local time
- Today, 05:23
- Joined
- Aug 27, 2014
- Messages
- 2
Hi all,
I'm trying to make a database program that searches for a given address and returns the zip code. I found that the best site to do this is google. The browser opens easily enough, but I'm having trouble with the program reading the <div Class> that the zip is displayed in. Here is my code:
here is the html associated :
<div class="vk_sh vk_gy" style="padding-top: 18px;">11700 U.S. 380 Cross Roads, TX 76227</div>
Any help would be appreciated
I'm trying to make a database program that searches for a given address and returns the zip code. I found that the best site to do this is google. The browser opens easily enough, but I'm having trouble with the program reading the <div Class> that the zip is displayed in. Here is my code:
Code:
Private Sub btnTest_Click()
Dim MyHTML_Element As HTMLDocument
Dim MyURL As String
Dim txt As HTMLInputTextElement
txtAddress = "11700 U.S. 380 Cross Roads, TX"
MyURL = "google.com/?gws_rd=ssl#q=" + txtAddress[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]‘The forum will not let me post links I assure you that the http is in the code[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
Set mybrowser = New InternetExplorer
mybrowser.Silent = True
mybrowser.Navigate MyURL
mybrowser.Visible = True
Do
Loop Until mybrowser.ReadyState = READYSTATE_COMPLETE
Set HTMLDoc = mybrowser.Document
Dim Doc As HTMLDocument
'variable for document or data which need to be extracted out of webpage
'capture zip code this is the problem area
Dim dd As Variant
dd = HTMLDocument.getElementsByClassName("vk_sh vk_gy")(0).innerText
MsgBox dd
End Sub
[/FONT][/COLOR]
here is the html associated :
<div class="vk_sh vk_gy" style="padding-top: 18px;">11700 U.S. 380 Cross Roads, TX 76227</div>
Any help would be appreciated
Last edited: