I am trying to create VBA code to complete an automated Google batch search of multiple names, to include the following :
- First name (A1 cell), plus Surname (B1 cell) [next name in A2 and B2 cells, and so on and so forth]
- and "corruption" or "fraud" or "money laundering" (C1 cell)
Final desired Google search : "John Doe" AND "fraud" OR "corruption" OR "money laundering"
- 3 second delay between each Google search
- Command search button
- I would like to input the first and last name in the Spreadsheet, not the Macro code
This is the current code I have created using online tutorials :
Sub Google_search_using_google_chrome()
Dim chromePath As String
Dim searchTerm As String
chromePath = """C:\Users\ianhe\AppData\Local\Google\Chrome\Application\chrome.exe"""
searchTerm = Sheet1.Range("A1").Value & Sheet1.Range("B1").Value & Sheet1.Range("C1").Value
searchkeyword = Replace(searchkeyword, " ", "+")
Call Shell(chromePath & " -url https://www.google.com/search?q=" & searchTerm, vbNormalFocus)
End Sub
The current result I get is the following : JohnDoeandcorruption or "fraud i.e. there is not space between words, and only 1 quotation mark. When I include multiple words in the same cell, only the first code is taken into account.


searchTermbut after that you switch tosearchkeywordto replace spaces, then you finally usesearchTerm? Also what spaces are you replacing? Are there spaces in A1:C1?