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

reading a google page using vba in access

have been using the code below but when i run it it throws up a  
compile error at line

Dim Browser As SHDocVw.InternetExplorer

not sure if this is a referance problem or what any ideas
or better code to do this

Dim Browser As SHDocVw.InternetExplorer
    Dim HTMLDoc As MSHTML.HTMLDocument

    Set Browser = New SHDocVw.InternetExplorer                     ' create a browser
    Browser.Visible = True                                         ' make it visible
    Application.StatusBar = ".... opening page"
    Browser.navigate "https://www.google.com/search?num=100&q=Isabella+G.+SANOFI+linkedin&oq=Isabella+G.+SANOFI+linkedin&gs_l=serp.3...3799.5413.0.5732."                       ' 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
    Set HTMLDoc = Nothing
    Set Browser = Nothing
1 Solution
When you look at your references, are there any that show up as missing?

You might try this late binding approach. Remove the broken reference.
Dim Browser As Object
set Browser = CreateObject("InternetExplorer.Application")

Open in new window

sydneyguyAuthor Commented:
thanks for the help ended up going a better direction
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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