+ Reply to Thread
Results 1 to 11 of 11

Using VBA to run a Google Search

  1. #1
    Registered User
    Join Date
    08-11-2011
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007/ 2010
    Posts
    72

    Red face Using VBA to run a Google Search

    Here's what I would like to do...

    When someone clicks on the "Library" button in a Workbook, I want a small window to pop up requesting input from the user - "Please enter the zip code for the area you're trying to search."

    Then, an IE window pops up with the search results displaying.

    Does this make sense?


    I like a challenge, so if you could point me in the right direction, I would appreciate it. Please don't post the entire code I would need. I would like to try and work some of it out on my own.

    Much thanks!

    -Jared

  2. #2
    Registered User
    Join Date
    12-13-2011
    Location
    NC, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Using VBA to run a Google Search

    First step is to enable internet controls:
    Open your workbook and then press ALT+F11 to open the VBE.
    Press ALT+T followed by the Enter key.
    Scroll down the list until you find Microsoft Internet Controls.
    Press the Space bar to select it, and press Enter
    or any code you try will error out

  3. #3
    Registered User
    Join Date
    12-13-2011
    Location
    NC, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Using VBA to run a Google Search

    Here is Step 2 Launching IE and going to Google
    Should give you a good start

    Please Login or Register  to view this content.
    If it where me I would create a UserForm that opens when they click Library button

  4. #4
    Registered User
    Join Date
    08-11-2011
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007/ 2010
    Posts
    72

    Re: Using VBA to run a Google Search

    suaibsech,

    I should have told you first... I have Excel 2010. I don't know if that changes any instruction. I followed your instruction and I don't have "Microsoft Internet Controls" on that References list. Here's what is already checked off...

    -Visual Basic for Applications
    -Microsoft Excel 14.0 Object Library
    -OLE Automation
    -Microsoft Office 14.0 Object Library


    Is there another setting this might be under in Office 2010?

    Thanks,

    Jared

  5. #5
    Registered User
    Join Date
    12-13-2011
    Location
    NC, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Using VBA to run a Google Search

    I have Excel 2010 also so it should work if it isn't there there are a few things you can try
    1) Update and/or Reinstall Internet Explorer must be IE7 or Higher
    2) start > cmd > regsvr32 shdocvw.dll
    see if it appears in list after

  6. #6
    Registered User
    Join Date
    08-11-2011
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007/ 2010
    Posts
    72

    Re: Using VBA to run a Google Search

    I did as you said and I got the following error...

    DllRegisterServer in shdocvw.dll failed.
    Return code was: 0x0070005


    I am at work though and that may be the issue... I will try this at home, where I use Excel 2007 and see what happens then.

    Any other work arounds for this issue?

    -Jared

  7. #7
    Registered User
    Join Date
    12-13-2011
    Location
    NC, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Using VBA to run a Google Search

    Maybe you dont have full admin access in registry try this

    1) Make sure that you are logged into the computer as local Administrator, or are part of the local Administrator group.
    2) To identify which registry key is causing the problem use Regmon (a freeware tool published by SysInternals). Use Regmon to capture all registry access when regsvr32 is run. If an ‘OpenKey’ request fails with ‘Access Denied’ (which is listed by Regmon as ‘ACCDENIED’) then run regedt32 and check the permissions on that registry key. If necessary change the permissions on the key to grant local Administrators ‘Full Control’.
    3. Finally, try registering the COM object again.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Using VBA to run a Google Search

    Why would you need access to the Registry to run VBA code?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  9. #9
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Using VBA to run a Google Search

    Use another library: microsoft XML version 3.0



  10. #10
    Forum Contributor
    Join Date
    12-26-2010
    Location
    Kansas City, Kansas
    MS-Off Ver
    Excel 2007
    Posts
    147

    Re: Using VBA to run a Google Search

    Hi j

    does the code below work - or - error out?

    If not - u can use the variable oIE as your variable for IE.
    (It will obviate the need to create a reference to the IE thingie ....)

    here is some "noodling" code I bumped into ....
    http://scriptorium.serve-it.nl/view.php?sid=30

    regards
    John


    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-11-2011
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007/ 2010
    Posts
    72

    Re: Using VBA to run a Google Search

    What I ended up having to do was enable the MS Internet Controls from home (where I use Office 2007), then I sent it back to myself at work and it's still showing MS Internet Controls as enabled. Apparently, that enabling shares between the two MS Office systems. I'm working on the code now.

    Please subscribe to this thread if you'd like to continue helping me.

    Much thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1