Results 1 to 7 of 7
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    utility to handle searches in many files (word97 sr2b)

    Hiya

    the scenario we have is we have a directory with many word files. we would like to do a search for a particular word on all the files & at the end of the search have a report generated that displays the filenames of where the word was located.
    I know there are like index tools out there but I dont know the names off the top of my head.

    if you could steer me in the right direction it would be greatly appreciated.
    Diana

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: utility to handle searches in many files (word97 sr2b)

    You can use the FileSearch object. Here is a sample macro you could use as a starting point. It prompts the user for a text to search for and a folder to search in, then writes a simple report in the current document.

    Sub SearchText()
    Dim i As Integer
    Dim strSearchText As String
    Dim strSearchIn As String

    strSearchText = InputBox("Text to search for")
    If strSearchText = "" Then Exit Sub

    strSearchIn = InputBox("Folder to search in")
    If strSearchIn = "" Then Exit Sub

    With Application.FileSearch
    .NewSearch
    .LookIn = strSearchIn
    .SearchSubFolders = True
    .FileType = msoFileTypeWordDocuments
    .TextOrProperty = strSearchText

    If .Execute > 0 Then
    Selection.TypeText .FoundFiles.Count & _
    " file(s) found in " & strSearchIn & _
    " containing '" & strSearchText & "'."
    Selection.TypeParagraph
    Selection.TypeParagraph
    For i = 1 To .FoundFiles.Count
    Selection.TypeText .FoundFiles(i)
    Selection.TypeParagraph
    Next i
    Else
    Selection.TypeText "No files found in " & _
    strSearchIn & " containing '" & _
    strSearchText & "'."
    End If
    End With
    End Sub

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: utility to handle searches in many files (word97 sr2b)

    Hi Diana:
    There is a free utility that I mentioned in Software (but can't find now because the search facility is down). It's called Wilbur. Check it out; it's wonderful. There is also a free utility from PC Magazine called FileGrab that will allow you to drag or paste filenames into it's window & then print it. Unfortunately, I don't have the exact URL & I think PC Magazine now charges a subscription fee for accessing it's downloads.

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: utility to handle searches in many files (word97 sr2b)

    Hi Phil

    I had a look at the software & it worked a treat. ie it meet the requirements for our user.
    many thanks!

    Diana

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: utility to handle searches in many files (word97 sr2b)

    Hi Hans

    I had a look at the code & it worked a treat. I also downloaded the software that Phil suggested & that worked a treak. so we went with freeware software.
    many thanks again!

    Diana

  6. #6
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: utility to handle searches in many files (word97 sr2b)

    Hi Phil

    I had a look at the software & its great.
    However I would also like to display the page numbers of the files the searches were found. is this possible in the software do you know? or is there another utility that displays
    file name & page number & the search result.

    many thanks
    Diana

  7. #7
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: utility to handle searches in many files (word97 sr2b)

    Hi Diana:
    You're quite welcome. No, unfortunately Wilbur won't give you the page number for the files that it indexes. Also, if you double click the file that it found, the file opens, but not to the spot where the found word exists. Actually, both of these are understandable. Page numbers are kept internally within an application & depend on settings such as margins, paper size, & orientation (& even the printer). Wilbur merely searches for the text, can report multiple results & is independent of the application.

    It does let you read the word or phrase in context. Pressing the + sign on the numpad will expand or contract the found word to include or exclude the surrounding paragraphs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •