Hello,

I wanted to use visual basic macro in excel to pull search results from Google. Since I am not very familiar with how visually basic macro works in excel, I found the following code from a tutorial online.

Const GOOGLE_WEBSERVER = "www.google.com"

Function BuildSERPURL(ByVal term As String, ByVal start As Integer) As String
    BuildSERPURL = "http://" & GOOGLE_WEBSERVER & "/search?start=" & start & "&q=" & term
End Function

This code definitely works in excel, if and only if I'm running the macro in United States. When I tried to run this code from China, I am getting results from Google Hong Kong instead. Is there a way to stop the redirection, so that when I am using this macro in China, I'll be still getting search result from United States stored in the excel file.

I know this question is kind of out of nowhere, but your help is really appreciated.

Google results depend allways on the country from which you are searching/querying (logged in at internet). If you really need the US results you have to use an intermediate US computer which acts as a server to your Excel and as a client to google.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.