sydneyguy
asked on
reading a web page with vba and looking at the object results in the viewer
Wishing to view the data on a web page returned and looking at how the data is arranged in the HTMLDoc = Browser.Document in the locals window.
in this instance i am doing a search that brings us 2 items for ease of understanding.
I ma guessing that the HTMLDoc have included the screen shot of the debuger just trying to find were the item
Your search - "ewwwxtra dog kinks" - did not match any documents.
and
Xtra Dog¿
www.xtradog.com
is located in the debuger so i can see how it is structed
any help will be appreciated
I am running this out of access 2003
Private Sub read_google_Click()
On Error GoTo Err_read_google_Click
' *********** http://vba-corner.livejournal.com/4623.html
' on how to do the vba
Dim Browser As Object
Set Browser = CreateObject("InternetExpl orer.Appli cation")
Dim HTMLDoc As MSHTML.HTMLDocument
Set Browser = New SHDocVw.InternetExplorer ' create a browser
Browser.Visible = True ' make it visible
' Application.StatusBar = ".... opening page"
' navigate to page
Browser.navigate "https://www.google.com/search?q=%22ewwwxtra+dog+kinks%22&btnG=Search" ' navigate to page
' WaitForBrowser Browser, 10 ' wait for completion or timeout
' Application.StatusBar = "gaining control over DOM object"
Set HTMLDoc = Browser.Document ' load the DOM object
' WaitForBrowser Browser, 10
' at this point you can start working with the DOM object. Usefull functions are
' getElementByID(string)
' getElementsByTagName(strin g)
' getElementsByName(string)
' getAttribute(string)
' .setAttribute string, string .... to change field values, click a button etc.
' Application.StatusBar = ""
' time to clean up
MsgBox HTMLDoc.activeElement.all. item1.uniq ueNumber
Browser.Quit
Set HTMLDoc = Nothing
Set Browser = Nothing
Exit_read_google_Click:
Exit Sub
Err_read_google_Click:
MsgBox Err.Description
Resume Exit_read_google_Click
End Sub
in this instance i am doing a search that brings us 2 items for ease of understanding.
I ma guessing that the HTMLDoc have included the screen shot of the debuger just trying to find were the item
Your search - "ewwwxtra dog kinks" - did not match any documents.
and
Xtra Dog¿
www.xtradog.com
is located in the debuger so i can see how it is structed
any help will be appreciated
I am running this out of access 2003
Private Sub read_google_Click()
On Error GoTo Err_read_google_Click
' *********** http://vba-corner.livejournal.com/4623.html
' on how to do the vba
Dim Browser As Object
Set Browser = CreateObject("InternetExpl
Dim HTMLDoc As MSHTML.HTMLDocument
Set Browser = New SHDocVw.InternetExplorer ' create a browser
Browser.Visible = True ' make it visible
' Application.StatusBar = ".... opening page"
' navigate to page
Browser.navigate "https://www.google.com/search?q=%22ewwwxtra+dog+kinks%22&btnG=Search" ' navigate to page
' WaitForBrowser Browser, 10 ' wait for completion or timeout
' Application.StatusBar = "gaining control over DOM object"
Set HTMLDoc = Browser.Document ' load the DOM object
' WaitForBrowser Browser, 10
' at this point you can start working with the DOM object. Usefull functions are
' getElementByID(string)
' getElementsByTagName(strin
' getElementsByName(string)
' getAttribute(string)
' .setAttribute string, string .... to change field values, click a button etc.
' Application.StatusBar = ""
' time to clean up
MsgBox HTMLDoc.activeElement.all.
Browser.Quit
Set HTMLDoc = Nothing
Set Browser = Nothing
Exit_read_google_Click:
Exit Sub
Err_read_google_Click:
MsgBox Err.Description
Resume Exit_read_google_Click
End Sub
Can you rephrase the question?
ASKER
ok will try
when the page loads when the Set HTMLDoc = Browser.Document this loads in the debuger when you step through, in there is all the objects display properties, i wish to see were in the debuger and under the object drill down menus this page of information is held and view it in its individual object position. ie
"ewwwxtra dog kinks"
were does this and under what is it located
when the page loads when the Set HTMLDoc = Browser.Document this loads in the debuger when you step through, in there is all the objects display properties, i wish to see were in the debuger and under the object drill down menus this page of information is held and view it in its individual object position. ie
"ewwwxtra dog kinks"
were does this and under what is it located
ASKER
what i am trying to do is to get the page information into a string variable so that i can pharse the data and then view it
when the page loadsWhat page - any page a specific page?
i wish to see were in the debuger and under the object drill down menus this page of information is heldWhat page information are you looking for?
"ewwwxtra dog kinks"What is special about this particular phrase?
This may be familiar to you but we have not seen any of your code or requirements before - you need to make it clear what you are trying to do.
ASKER
What page - any page a specific page?
yep any google page i could do it for dogs or cars or
"https://www.google.com/search?q=%22ewwwxtra+dog+kinks%22&btnG=Search"
this page gives on add and did not find any rec so good example of what is returned
could have cars and the page would have been filled with 10 returns or 100 depending on how the browser is set up
What page information are you looking for?
i am looking for the 3 returned bits of information for each site returned
1) heading and were its found
2) what sites it foudn on
3) the 2 lines of info that comes with the page
if theres none found it will just say none found
ie Your search - "ewwwxtra dog kinks" - did not match any documents.
What is special about this particular phrase?
nothing absolutly nothing it coudl be any thing bit minimal return instead of 100 peices returned it returns well no 2 one from expets excahnge and an ad
it has nothing to do with the line of search for google,
all i want is a copy of the page the whole lot will do, ie edit select all> copy to a text doc this would do for the moment.
and i will figure out how the object model and were its stored in the model later
thanks for the help so far
yep any google page i could do it for dogs or cars or
"https://www.google.com/search?q=%22ewwwxtra+dog+kinks%22&btnG=Search"
this page gives on add and did not find any rec so good example of what is returned
could have cars and the page would have been filled with 10 returns or 100 depending on how the browser is set up
What page information are you looking for?
i am looking for the 3 returned bits of information for each site returned
1) heading and were its found
2) what sites it foudn on
3) the 2 lines of info that comes with the page
if theres none found it will just say none found
ie Your search - "ewwwxtra dog kinks" - did not match any documents.
What is special about this particular phrase?
nothing absolutly nothing it coudl be any thing bit minimal return instead of 100 peices returned it returns well no 2 one from expets excahnge and an ad
it has nothing to do with the line of search for google,
all i want is a copy of the page the whole lot will do, ie edit select all> copy to a text doc this would do for the moment.
and i will figure out how the object model and were its stored in the model later
thanks for the help so far
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
figured it out