- 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/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)
-
NumberofResults = Mid(results_var, 1 + pos_2, (-1 + pos_3 - pos_2))
-
Range("B" & RowCount) = NumberofResults
-
RowCount = RowCount + 1
-
Loop
-
End With
-
End Sub
Hi all,
I was wondering if these codes are correct because I cannot run the macros
I would imagine that you woould need to build the List of KeyWords in a String prior to passing this String to the Google Search Engine, such as: - Dim searchWords As String
-
Dim RowCount As Integer
-
-
With Sheets("Sheet1")
-
RowCount = 1
-
Do While .Range("A" & RowCount) <> ""
-
searchWords = searchWords & .Range("A" & RowCount).Value & "+"
-
RowCount = RowCount + 1
-
Loop
-
End With
-
-
'Remove Trailing '+' and display
-
MsgBox Left$(searchWords, Len(searchWords) - 1)
which would produce a Keyword String such as: - One+Two+Three+Four+Five+Siux+Seven +Eight+Nine+Ten
1 915
I would imagine that you woould need to build the List of KeyWords in a String prior to passing this String to the Google Search Engine, such as: - Dim searchWords As String
-
Dim RowCount As Integer
-
-
With Sheets("Sheet1")
-
RowCount = 1
-
Do While .Range("A" & RowCount) <> ""
-
searchWords = searchWords & .Range("A" & RowCount).Value & "+"
-
RowCount = RowCount + 1
-
Loop
-
End With
-
-
'Remove Trailing '+' and display
-
MsgBox Left$(searchWords, Len(searchWords) - 1)
which would produce a Keyword String such as: - One+Two+Three+Four+Five+Siux+Seven +Eight+Nine+Ten
Sign in to post your reply or Sign up for a free account.
Similar topics
by: john |
last post by:
Ran Windows update tonight. Since then I get this error:
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
...
|
by: mork |
last post by:
I am so frustrated - any help is appreciated.
When trying to use common functions like Left and/or Mid I get the
following error:
Run-time Error '5':
Invalid Procedure Call or Argument
In my...
|
by: Zoury |
last post by:
Hi there!
I'm using a COM component from my C# application and I can't get it to work
properly. I get a COMException (Invalid procedure call or argument) on this
line :
//***...
|
by: Matt |
last post by:
I am receiving the following error from the simple script below. This works
fine from a .NET form but when I access the dll from a Classic ASP page it
fails.
Microsoft VBScript runtime error...
|
by: Eric |
last post by:
I run a program which read emails from a text file. There is some thing
invalid in one or more text file. When program is busy doing parsing it
shows that error and process stop. I dont know which...
|
by: AparnaKulkarni |
last post by:
Hello,
I m working with Templates in MS Word. I have established the user Template locations in Word with ".dot" file But after that I m getting error as "Invalid procedure call or argument...
|
by: HaggardSmurf |
last post by:
Private Sub Downloader1_DownloadComplete(MaxBytes As Long, SaveFile As String)
If MsgBox("Donwnload Finished. Would you like to install now?", vbInformation + vbYesNo, "Blue Cherry Media...
|
by: PurpleWitch |
last post by:
Hi there
I'm using an Access 2000 DB on Office 2000. The following Pivot Table worked fine 2 days ago, but no I'm getting the "Invalid Procedure Call or Argument" error when using Pivot Table...
|
by: dennijr |
last post by:
ok, shell always used to be easy for me, now its starting to get annoying cause i dont know wats wrong
heres the simplist code possible:
Private Sub IExplorer_Click()
a = Shell("C:\Program...
|
by: PrakashN |
last post by:
Hai
I have done validation for mandatory fields when adding a record in a Button click event.if i click that button using shot cut keys without selecting the option, i m receiving...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |