Results 1 to 3 of 3

Google macro workes fine until now

Threaded View

  1. #1
    Registered User
    Join Date
    10-05-2011
    Location
    Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    3

    Google macro workes fine until now

    This macro (number of Google search results) worked fine but about 2 months ago it stopped working. In column A word to search e.g. "Microsoft" and in column B should the number of search results appear.

    Has something changed in Google? Thanks in advance.


    Public Sub ExcelGoogleSearch()
    
    Dim searchWords As String
    
    With Sheets("Sheet1")
    RowCount = 1
    Do While .Range("A" & RowCount) <> ""
    searchWords = .Range("A" & RowCount).Value
    
    
    ' Get keywords and validate by adding + for spaces between
    searchWords = Replace$(searchWords, " ", "+")
    
    ' Obtain the source code for the Google-searchterm webpage
    search_url = "http://www.google.com.au/search?hl=en&q=" & searchWords & "&meta="""
    Set search_http = CreateObject("MSXML2.XMLHTTP")
    search_http.Open "GET", search_url, False
    search_http.send
    results_var = search_http.responsetext
    Set search_http = Nothing
    
    ' Find the number of results and post to sheet
    pos_1 = InStr(1, results_var, "resultStats>", vbTextCompare)
    pos_2 = InStr(3 + pos_1, results_var, ">", vbTextCompare)
    pos_3 = InStr(pos_2, results_var, "<nobr>", vbTextCompare)
    If pos_1 <> 0 Then
    NumberofResults = Mid(results_var, 1 + pos_2, (-1 + pos_3 - pos_2))
    Range("B" & RowCount) = NumberofResults
    Else
    Range("B" & RowCount) = 0
    End If
    RowCount = RowCount + 1
    
    ' Waits 5 seconds
    Application.Wait Time + TimeSerial(0, 0, 4)
    ' Continues here after pause
    
    Loop
    End With
    
    End Sub
    Moderator Note:

    Pls use code tags around your code next time as per forum rules.
    Last edited by Juul1234; 12-09-2013 at 11:05 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Fine tuning a macro...
    By cafc_fuller in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-30-2013, 07:41 AM
  2. [SOLVED] Need help fine tuning a macro
    By jaimeteele in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-27-2013, 04:43 PM
  3. [SOLVED] What is wrong with this macro? I think it looks fine :(
    By KATIEexcel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-12-2012, 07:48 AM
  4. can record macro, but RTE5 when ran. Macro works fine on another PC.
    By boyd98 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-27-2011, 01:10 PM
  5. Macro doesn't work on button, but fine from Macro menu!
    By DrEvilAces in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-16-2008, 10:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1