Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel "data base engine failure"? | Excel Worksheet Functions | |||
Emulating older pivot table "engine" in Excel 2007? Need help... | Excel Worksheet Functions | |||
Seo , Search Engine Optimizer , Seo Search engine Optimization , search engine optimization services, SEO Consulting | Setting up and Configuration of Excel | |||
Seo , Search Engine Optimizer , Seo Search engine Optimization , search engine optimization services, SEO Consulting | Links and Linking in Excel | |||
Seo , Search Engine Optimizer , Seo Search engine Optimization , search engine optimization services, SEO Consulting | Charts and Charting in Excel |