How to Search for Things in Google Chrome Using Microsoft Excel Macros (NO CODING KNOWLEDGE REQUIRED)

About: I like to program macros in excel, do woodworking, fish, go surfing, and do electronics projects to automate things around the house. I have a beautiful wife, dog, and a son that is on the way!

Did you know that you can easily add a search feature to your excel spreadsheet?!

I can show you how to do it in a couple easy steps!

In order to do this you will need the following:

  • A computer - (CHECK!)
  • Microsoft Excel
  • Google Chrome installed on your computer
    • (make sure that it is installed in the following folder: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe)
  • Just a couple of quick minutes to follow along with this instructable

Step 1: Start a New Excel Workbook/sheet

Open Excel and click:

  • File
  • New
  • Blank

Step 2: Add the Developer Tab to Your Sheet

This step will allow you to add and create your own excel macros.

AND IT COMES STANDARD in excel, woohoo!

  • Click File
  • Click Options
  • Customize Ribbon
  • Then find developer on the left column and click on it
  • Then click "Add" and you should see Developer on the right column as shown in the picture

Once that is there you can exit the options after saving (click OK on the bottom)

Step 3: Click on the Developer Tab

Now you should see another tab added to your ribbon on the top of the sheet.

Click on it and just check out the features you can do with it.

Step 4: Add a Clickable Button

From here you will do the following:

  • Click on Insert
  • Then go down to the choice that looks like a box
    • It should be labelled "Command Button ActiveX Control"

Step 5: Draw Your Button Anywhere You Want

Make the box as big or small as you want, and anywhere you want!

When you have it where you want it next we will be double clicking inside of it to add our code.

Step 6: Add Your Code to the Button

YOU DO NOT NEED TO KNOW HOW TO CODE FOR THIS PART, JUST COPY AND PASTE MY CODE AS FOLLOWS:

Private Sub CommandButton1_Click()


Dim chromePath As String

Dim search_string As String

Dim query As String

query = InputBox("Enter here your search here", "Google Search")

search_string = query

search_string = Replace(search_string, " ", "+")

chromePath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

Shell (chromePath & " -url http://google.com/#q=" & search_string)


End Sub

Step 7: Click Save and Design Mode

You can save this code section and close out that box while keeping Excel open still.

Then click Design Mode up on the ribbon to actually let you click the button now.

(Recommend saving at this point in case you get any errors)

Step 8: Click That Button Now!

When you click it with Design Mode off you should have this box pop up.

If not you may unfortunately be getting some errors.

If you do fret not you may have just missed putting in the code wrong or some other oversight that I may be missing.

Feel free to comment below and I will look into updating the -ible to help you!

You should be able to enter text now and to test I used: "Excel Wizard"

Step 9: Google Chrome Has Been Opened and Now You Can Navigate As Normal

This should open and do a google search based on the term you entered in.

For now it is just searching, but in future lessons we can add to this to make it input data back into excel and do all kinds of crazy userfriendly stuff. Neat huh?!

Step 10: Save and Close the Sheet As a "Macro Enabled Workbook"

Make sure to save this workbook as a "Macro Enabled Workbook" otherwise it will cause error messages to pop up at exit and re-open.

Hope this helps and feel free to modify the code to help meet your needs or add on to it with your own features!

Enjoy!

Share

    Recommendations

    • Big and Small Contest

      Big and Small Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • PCB Contest

      PCB Contest

    Discussions

    0
    None
    dasheno

    Tip 4 months ago

    Quick tip: if the pictures look weird in the thumbnail you can click on them to view the full picture!