Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Excel "search engine"

Hi,

I was just wondering if anyone was aware of any existing code I could use to
make an excel search engine. My plan is to have a list in one sheet and then
in another sheet a cell to enter a search into. I want to use just excel and
not access or anything else.

I want people to be able to type in a name/word and have all the results
from the list which match the search appear below. In other words, I want it
to work just like a google-style search page.

Any ideas? Anyone seen it done before?

Any help greatly appreciated!

Thanks,
Josh
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Excel "search engine"

I wrote the code below for somebody a few months ago. I opened an internet
explorer application from excel to get the results. I made the internet
explorer application visible but I could make it invisible. This code only
gets the results from the 1st page.




Public Sub GoogleSearch1()
'Use and input box for typing in the search words
Dim szSearchWords As String
Dim szResults As String
With Sheets("Sheet1")
szSearchWords = .Range("B2").Value
End With
If Not Len(szSearchWords) 0 Then Exit Sub

'Get keywords and validate by adding + for spaces between
szSearchWords = Replace$(szSearchWords, " ", "+")

Dim ie As Object 'InternetExplorer
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "http://www.google.com/search?hl=en&q=" & _
szSearchWords & "&meta="

'Loop until the page is fully loaded
Const READYSTATE_COMPLETE = 4
Do Until ie.ReadyState = READYSTATE_COMPLETE
With ie
.Visible = True
End With
Loop

Set Results = ie.document.getelementsbytagname("P")
For Each itm In Results
If InStr(UCase(itm.innertext), "RESULTS") Then
MsgBox (itm.innertext)
Exit For
End If
Next itm

With Sheets("Sheet2")
RowCount = 1
For Each itm In ie.document.all
.Range("A" & RowCount) = itm.tagname
.Range("B" & RowCount) = itm.classname
.Range("C" & RowCount) = Left(itm.innertext, 1024)

RowCount = RowCount + 1
Next itm
.Cells.VerticalAlignment = xlTop
End With

Set Results = ie.document.getelementsbytagname("LI")
With Sheets("Sheet3")
RowCount = 1
For Each itm In Results
.Range("A" & RowCount) = itm.innertext
RowCount = RowCount + 1
Next itm
.Cells.VerticalAlignment = xlTop
End With
'Explicitly clear memory
Set ie = Nothing
End Sub




"Josh Craig" wrote:

Hi,

I was just wondering if anyone was aware of any existing code I could use to
make an excel search engine. My plan is to have a list in one sheet and then
in another sheet a cell to enter a search into. I want to use just excel and
not access or anything else.

I want people to be able to type in a name/word and have all the results
from the list which match the search appear below. In other words, I want it
to work just like a google-style search page.

Any ideas? Anyone seen it done before?

Any help greatly appreciated!

Thanks,
Josh

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel "data base engine failure"? Phone Directory Delima Excel Worksheet Functions 1 March 28th 10 06:38 PM
Emulating older pivot table "engine" in Excel 2007? Need help... Brad Autry Excel Worksheet Functions 0 December 7th 09 08:45 PM
Seo , Search Engine Optimizer , Seo Search engine Optimization , search engine optimization services, SEO Consulting Se0 Guy Setting up and Configuration of Excel 0 March 8th 07 04:08 AM
Seo , Search Engine Optimizer , Seo Search engine Optimization , search engine optimization services, SEO Consulting Se0 Guy Links and Linking in Excel 0 March 8th 07 04:08 AM
Seo , Search Engine Optimizer , Seo Search engine Optimization , search engine optimization services, SEO Consulting Se0 Guy Charts and Charting in Excel 0 March 8th 07 04:08 AM


All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"