• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 628
  • Last Modified:

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.
Xtra Dog¿

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

web viewdebug

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("InternetExplorer.Application")

    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(string)
    '     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.uniqueNumber
    Set HTMLDoc = Nothing
    Set Browser = Nothing

    Exit Sub

    MsgBox Err.Description
    Resume Exit_read_google_Click
End Sub
  • 4
  • 3
1 Solution
Julian HansenCommented:
Can you  rephrase the question?
sydneyguyAuthor Commented:
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
sydneyguyAuthor Commented:
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
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Julian HansenCommented:
when the page loads
What 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 held
What 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.
sydneyguyAuthor Commented:
What page - any page a specific page?
yep any google page i could do it for dogs or cars or
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
Julian HansenCommented:
So basically you want to screen scrape google?

Send a search phrase to google and get the results back?
sydneyguyAuthor Commented:
figured it out
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now