I don't know about 3000 documents at one time (might crash Word), but I
believe it could be done in batches with VBA.
It would now be a simple process to write your code from scratch. You might
download my VBA Find and Replace template AddIn to get and idea of the code
involve.
http://gregmaxey.mvps.org/VBA_Find_And_Replace.htm
While it doesn't have the More>Format>Style feature on the User Interface,
you could easily add this functionality manually in the code itself. You
would want to edit the following function as shown:
Public Function SrchAndRplInStry(ByVal SrchRng As Range) As Boolean
Dim i As Integer
If bMultiWord Then
For i = 2 To UBound(ListArray)
With SrchRng.Find
.ClearFormatting
.Replacement.ClearFormatting
If Me.CheckBox1.Value = True Then .MatchCase = True
If Me.CheckBox2.Value = True Then .MatchWholeWord = True
If Me.CheckBox3.Value = True Then .MatchWildcards = True
.Text = ListArray(i, 1)
.Replacement.Text = ListArray(i, 2)
If Me.CheckBox6 Then
.Replacement.Highlight = True
End If
.Execute Replace:=wdReplaceAll
End With
Next i
Else
With SrchRng.Find
.ClearFormatting
.Replacement.ClearFormatting
If Me.CheckBox1.Value = True Then .MatchCase = True
If Me.CheckBox2.Value = True Then .MatchWholeWord = True
If Me.CheckBox3.Value = True Then .MatchWildcards = True
On Error GoTo Oops
.Format = True
*****************************************************************************
.Text = ""
*******************************************************************************
.Style = "OldStyleName"
*************************************************************************
.Replacement.Text = ""
*************************************************************************
.Replacement.Style = "NewStyleName"
If Me.CheckBox6 Then
.Replacement.Highlight = True
End If
.Execute Replace:=wdReplaceAll
End With
End If
SrchAndRplInStry = True
Exit Function
Oops:
If Err.Number = 5560 Then
MsgBox "The Find field contains an invalid pattern match expression.",
vbOKOnly, _
"Invalid Pattern."
With Me.TextBox1
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
SrchAndRplInStry = False
Err.Clear
ElseIf Err.Number = 5623 Then
MsgBox "The Replace field contains a group number which is out of range.",
vbOKOnly, _
"Invalid Group Number."
With Me.TextBox2
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
SrchAndRplInStry = False
Err.Clear
ElseIf Err.Number = 5625 Then
MsgBox "The characters ^& and ^c are invalid in the Find field.",
vbOKOnly, _
"Invalid Special Character."
With Me.TextBox1
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
SrchAndRplInStry = False
Err.Clear
ElseIf Err.Number = 5692 Then
MsgBox "The character you entered is not a valid special character inthe"
_
& " in the Find field or is not supported when the Usewildcard" _
& " checkbox is selected.", vbOKOnly, "Invalid Character."
With Me.TextBox1
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
SrchAndRplInStry = False
Err.Clear
ElseIf Err.Number <> 0 Then
Dim Msg
Msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
SrchAndRplInStry = False
Err.Clear
End If
End Function
When you run the form you will have to enter something in the Find field to
prevent and error but it will be transparent.
--
Greg Maxey - Word MVP
My web sitehttp://gregmaxey.mvps.org
Word MVP web sitehttp://word.mvps.org
McCain/Palin '08 !!!- Hide quoted text -
- Show quoted text -