How to use VBA in Excel for Google Search

0 votes

Using VBA in Excel, I'm attempting to construct a Google Search technique. I want to enter a specific word or words in the pop-up box and have Google search those words together with a specified phrase.

Instead of having to input "License and Registration" every time I type a name, I would prefer the Google search to be "John Doe License and Registration" for instance.

How do I modify my code to include "License and Registration"?

Private Sub CommandButtonSearch_Click()
    Dim query As String
    Dim search_string As String
    Dim googleChromePath As String
    
    query = InputBox("Enter your keyword", "Google Search")
    search_string = Replace(query, " ", "+")
    
    googleChromePath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    
    Shell (googleChromePath & " -url http://google.com/search?q=" & search_string)

End Sub

How it looks:
enter image description here

How I would like it to look:
enter image description here

Oct 7 in Others by Kithuzzz
• 20,660 points
149 views

1 answer to this question.

0 votes

Try this:

Private Const LicenseRegistration As String = "+License+and+Registration"
Private Sub CommandButtonSearch_Click()
    Dim query As String
    Dim search_string As String
    Dim googleChromePath As String
    
    query = InputBox("Enter your keyword", "Google Search")
    search_string = Replace(query, " ", "+") & LicenseRegistration
    
    googleChromePath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    
    Shell (googleChromePath & " -url http://google.com/search?q=" & search_string)

End Sub
answered Oct 7 by narikkadan
• 37,660 points

Related Questions In Others

0 votes
1 answer

How to use for loop in Flutter?

Hi@akhtar, As the name suggests Dart for in ...READ MORE

answered Sep 3, 2020 in Others by MD
• 95,380 points
17,008 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to print an Excel Sheet using VBA with Nitro PDF Creator in Excel 2016

you can use the built-in excel facilities ...READ MORE

answered Sep 24 in Others by narikkadan
• 37,660 points
131 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,720 points
454 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
2,227 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9 in Others by gaurav
• 22,040 points
71 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16 in Others by Edureka
• 13,640 points
210 views
0 votes
1 answer

SEO - How to Show Phone Numbers in Google Search

<div itemscope itemtype="http://schema.org/LocalBusiness">         <span itemprop="telephone"><a href="tel:01234555666">Link Text Here</a></span>     </div> use ...READ MORE

answered Feb 14 in Others by narikkadan
• 37,660 points
67 views
0 votes
1 answer

SEO - How to Show Phone Numbers in Google Search

<div itemscope itemtype="http://schema.org/LocalBusiness"> ...READ MORE

answered Feb 22 in Others by narikkadan
• 37,660 points
298 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP