Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > document searching


Reply
 
Thread Tools Display Modes
  #1  
Old 02-01-2003, 01:41 PM
TylerC
Guest
 
Posts: n/a
Post document searching


Hi,

I don't know if this is possible using VB but I figured I'd atleast look into it (I don't really know ANYTHING about VB programming).

What I need to do is create a program of some sort to search the contents of a long list of MS Word files and display the names of the files with contents matching the search criteria.

My initial idea was to try and use MS Access to do this, I'm still pursuing it as an option but I think that VB will be easier to deploy to the rest of the members of my small organization when the project is completed.

Any help with this will be greatly appreciated.

Tyler
Reply With Quote
  #2  
Old 02-01-2003, 02:33 PM
GavinO's Avatar
GavinO GavinO is offline
Coder of Fortune

Retired Leader
* Expert *
 
Join Date: Dec 2002
Location: Troy, NY USA
Posts: 3,120
Default

Well, the easiest (and least efficient) method would be something like this:
Code:
for i=1 to len(ofthefile) if instr(filetext$,searchtext$) then file_is_good next i
Of course, that just finds a particular string in order. If you want to have all of a bunch of words not necessarily in order, you need to do this for the if:
Code:
if instr(filetext$,searchtext$(1)) and instr(filetext$,searchtext$(2) ... then file_is_good
To do whole word search, you can put spaces on the beginning and end of words, and hope that they aren't at the end of a sentence. You could also do an or search for spaces at end or punctuation at end, or replace all punctuation with spaces before the search. You could probably also drive Word with your program to do the search with the preexisting search capabilities of Word.

Do note that this is the easiest to code, yet crudest, least efficient search routine I could come up with in 3 minutes. A search of the forum or google will probably give you a combnation of brilliant VB code and API calls.
__________________
-- The Gavster
Like to IRC? Try irc.randomirc.com
GavServer
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->