PDA

View Full Version : Solved: Google Search



mdmackillop
03-31-2005, 01:54 PM
Having viciously yoinked some code from Carlos,:devil: I appended it to a userform for a quick google search in word. I'd like to increase the responses to 25. but don't really follow the code. I've tried to obvious things (at least to my eyes)

Jacob Hilderbrand
03-31-2005, 01:58 PM
Did you try changing this line?

For i = 0 To 9

mdmackillop
03-31-2005, 02:02 PM
Yep!
There were two 9s, so I changed them both to 25

mvidas
03-31-2005, 02:32 PM
It looks like the search page it is pulling up only lists results 1-10, even if your google preferences say 100 per page.

You can make it 25 by making 3 changes
' Dim Parcial As String, meuArray(9, 1) As String
Dim Parcial As String, meuArray(24, 1) As String


'ObjXML.Open "GET", "http://www.google.com.br/search?hl=US&q (http://www.google.com.br/search?hl=US&q)=" &
'strSearch & "&meta=", False
ObjXML.Open "GET", "http://www.google.com.br/search?hl=US&num=100&start=0&q=" _
& strSearch & "&meta=", False
'the 100 here could be 25, may be a little quicker



' For i = 0 To 9
For i = 0 To 24

Should take care of it!

mdmackillop
03-31-2005, 02:48 PM
Thanks Matt,
Works a treat. I've posted the corrected file in the original question.

mvidas
03-31-2005, 03:03 PM
After looking a bit more into it, that may cause some problems on results 10-25. You may also want to change the instance of "26" to "25 + Len(i)".
I'm gonna take a look a little deeper, see if some more modifications can be made as well. I'll let you know either way

mvidas
04-01-2005, 09:35 AM
OK,
Just did a bit of work on this one.
First, I changed the variables to something I understood (no offense, Carlos! I just don't speak much Spanish).
I was having a few issues with the FollowHyperlink as well, so I changed the method to follow the link (should work with whatever the default browser is--if you have anything aside from IE where you are give it a try and let me know, I only have IE on my work computer).
Fixed it to display correct amount of results if less than 25 results found
Fixed it if no results found
Fixed it to follow correct links when news results come up on the google search (this one threw me off for a while)
Fixed an apostrophe thing in the response text (was showing up as "& # 3 9 ;" (without the quotes or the spaces between))
Fixed a few other minor issues that I can't specifically think of right now
Was going to change the Title/Link parsing to regexp, but with so few results and its not slow anyways, I decided to leave well enough alone

Give it a whirl, let me know if any issues arise! This was fun
Matt

Paleo
04-01-2005, 08:14 PM
Hi Matt,

it is Portuguese not Spanish, :rofl: . No offense taken.

Anne Troy
04-01-2005, 08:21 PM
Ya know....
Ya'll do some pretty amazing stuff around here.
I think it's dang impressive.

mdmackillop
04-05-2005, 01:41 PM
Hi Matt,
Thanks for the help. Somewhere between posting and getting your response, my PC stopped responding to the FollowHyperlinks command and other similar items, refusing to open web pages and so on. However reformatting the C drive and reinstalling everything seems finally to have done the trick, so I can at last try out your solution.

Paleo
04-10-2005, 11:45 PM
Wow, sounds like a very radical way to solve it Malcolm, :wot

MOS MASTER
04-11-2005, 11:14 AM
Hi mdmackillop, :D

Nice piece off work you guys put together!

If you like to Google from Word there's a nice Hack that you can incorporate in the Taskpane to do the search for you. (And show/follow it in the taskpane as well)

Check it out: http://hacks.oreilly.com/pub/h/2725

Enjoy! :thumb