|
-
Jan 9th, 2009, 04:05 PM
#1
Thread Starter
Addicted Member
VB6 Search Box to search for text inside multiple word documents
Hi everyone, what i am trying to do is make a search box in vb6 to search for a text inside multiple word files in a folder and display the result(filenames for all the files containing the searched text) in a listbox or flexgrid. For now my code can seach for a single file and displays result as a message box.
But i don't want to open the files while they are being searched.
Can anyone help me achieve this more or less like a windows search box that searches for a "text or a phrase" in multiple files without opening them and dsiplays the results as file icons.
Moreover i would really appreciate if someone has a similar solution for .pdf files as well
thanx a big time!!!!
________________________________________________________
My code:
Private Sub Command1_Click()
Dim find As String
find = txtfind.Text
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Open("C:\Hello.doc")
Set objSelection = objWord.Selection
objSelection.find.Text = find
objSelection.find.Forward = True
objSelection.find.MatchWholeWord = True
If objSelection.find.Execute Then
MsgBox "The search text was found."
Else
MsgBox "The search text was not found."
End If
End Sub
_______________________________________________________________
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|