How to use VBA in Excel for Google Search

+1 vote

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, 2022 in Others by Kithuzzz
• 38,000 points
1,696 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, 2022 by narikkadan
• 63,640 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,460 points
19,157 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, 2022 in Others by narikkadan
• 63,640 points
409 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, 2022 in Others by narikkadan
• 63,640 points
982 views
0 votes
1 answer
0 votes
1 answer

Excel VBA search based on cell values into folders and sub-folders to get the file path and data

This will create a listing of all ...READ MORE

answered Jan 19, 2023 in Others by narikkadan
• 63,640 points
2,060 views
0 votes
1 answer

Close One Tab within Chrome via VBA

Sod's law worked it out within a ...READ MORE

answered Feb 10, 2023 in Others by narikkadan
• 63,640 points
1,930 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,740 points
1,188 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
3,642 views
0 votes
1 answer

How to use relative names in Excel VBA

It appears you are looking for Range.Offset() http://msdn.microsoft.com/en-us/library/office/ff840060%28v=office.15%29.aspx However, you ...READ MORE

answered Dec 24, 2022 in Others by narikkadan
• 63,640 points
451 views
0 votes
1 answer

How do I use the Indirect Function in Excel VBA to incorporate the equations in a VBA Macro Function

Try this: Sub Test() Dim str As String: str ...READ MORE

answered Jan 19, 2023 in Others by narikkadan
• 63,640 points
1,025 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