![]() |
|
#2
|
||||
|
||||
|
Hi Guy,
You could do that with a macro like: Code:
Sub MultiDocumentSearch()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, wdDoc as Document, strFind as String
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
strFind = InputBox("String to Find?")
If strFind = "" Then Exit Sub
While strFile <> ""
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc.Range.Find
.ClearFormatting
.Text = strFind
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
wdDoc.Close SaveChanges:=True
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| search, search folders |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Replace text in multiple documents?
|
Roscoe | Word VBA | 7 | 07-31-2017 04:02 PM |
| Word 2010 / Master Index / Multiple Documents | bawrites | Word | 0 | 08-09-2011 11:02 AM |
Change Multiple Documents from US to UK language
|
swifty2010 | Word | 1 | 03-08-2011 02:00 PM |
| 2007 merging multiple documents into one master | hugheso | Word | 0 | 04-02-2009 04:31 AM |
page numbering across multiple documents
|
reitdesign | Word | 3 | 12-12-2008 11:55 AM |