Does anyone no of any way for VBA to interact with a search engine?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dsatino
    Contributor
    • May 2010
    • 393

    #1

    Does anyone no of any way for VBA to interact with a search engine?

    I don't have a specific issue to solve, so this is more conceptual than anything.

    I'm just curious if anyone knows of any methods in which I can capture a string in VBA and send that string via VBA to a search engine such as google.

    Any ideas would be greatly appreciated.

    Thx
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    My initial instinct says it can be done but I honestly don't have a clue how :D

    I'll see if I can find someone more likely to know the answer.

    Mary

    Comment

    • Lysander
      Recognized Expert Contributor
      • Apr 2007
      • 344

      #3
      I did something like this, but it was 6 years ago and I have long deleted the database. The way I did took two steps.

      First, get your string from VBA. Lets say it is "Find Me"

      You then need to create a text file on your hard disk, "Search.htm " and write to it the HTML codes to create a simple page with one reference on it.

      Something like
      <HTML>
      <HEAD>
      <TITLE></TITLE>
      </HEAD>
      <BODY>
      <A HREF="http://www.google.co.u k/search?q=find+m e">Search for Find Me</A><br><br>

      </BODY>
      </HTML>

      and then launch your browser with this file.

      (It's the code for launching the browser witht the filename that I have forgotten how to do)

      Explorer, or Firefox whatever opens up with on link. Click on that link and you are in the google search engine.

      Bit of a kludge, but it might give you some ideas.

      Comment

      • munkee
        Contributor
        • Feb 2010
        • 374

        #4
        To be fair you need to just take the string and pass it to a function:


        Code:
        Function Search(SearchIt As String)
        Dim stringUrl As String
        stringUrl = "http://www.google.com/search?q=" & SearchIt
        FollowHyperlink stringUrl
        End Function
        You can run a simple test in the immediate window using: ?Search("testin g")

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          Here is a little DB that I created, hopefully you will find it interesting, if not helpful. A User can specify either a single or multiple location parameters to Google Maps, which is then opened to display the appropriate Map. The Range is actually from a Country to a specific Street. It should be a simple matter, to change the context with VBA integration.
          Attached Files

          Comment

          • dsatino
            Contributor
            • May 2010
            • 393

            #6
            Thanks everyone, these are all helpful.

            Comment

            Working...