E
Enda
Hi all,
I would appreciate help the following.
I would like to replace all occurences in a document of the following
line:
\centerline{\includegraphics[ANYTEXT]{ANYTEXT}R
with
\centerline{\includegraphics[ANYTEXT]{ANYTEXT}}R
where R is the EOLF carriage return.
That is, add a closing } to all occurences of the given first line
that ends with only 1 closing }.
My initial attempts at a macro are included below.
Thanks in advance,
Enda
Public Sub repairDoubleBrace()
On Error GoTo ErrHandler
Dim doc As Document
Dim docRange As Range
Dim foundRange As Range
Set doc = ActiveDocument
Set docRange = doc.Content
With docRange
With .Find
.ClearFormatting
.Text = "\\centerline\{\\includegraphics[*]\{*\}^p"
.MatchWildcards = True
With .Replacement
.ClearFormatting
.Text = "\\centerline\{\\includegraphics[*]\{*\}\}^p"
End With
.Execute Replace:=wdReplaceAll
End With
End With
Exit Sub
ErrHandler:
Dim routine As String
routine = "repairCrossReferences "
Select Case Err.Number
Case Else
MsgBox routine _
& vbNewLine & Error(Err) _
& vbNewLine & Err.Number _
& vbNewLine & Err.Description _
& vbNewLine & Err.Source
End Select
End Sub
I would appreciate help the following.
I would like to replace all occurences in a document of the following
line:
\centerline{\includegraphics[ANYTEXT]{ANYTEXT}R
with
\centerline{\includegraphics[ANYTEXT]{ANYTEXT}}R
where R is the EOLF carriage return.
That is, add a closing } to all occurences of the given first line
that ends with only 1 closing }.
My initial attempts at a macro are included below.
Thanks in advance,
Enda
Public Sub repairDoubleBrace()
On Error GoTo ErrHandler
Dim doc As Document
Dim docRange As Range
Dim foundRange As Range
Set doc = ActiveDocument
Set docRange = doc.Content
With docRange
With .Find
.ClearFormatting
.Text = "\\centerline\{\\includegraphics[*]\{*\}^p"
.MatchWildcards = True
With .Replacement
.ClearFormatting
.Text = "\\centerline\{\\includegraphics[*]\{*\}\}^p"
End With
.Execute Replace:=wdReplaceAll
End With
End With
Exit Sub
ErrHandler:
Dim routine As String
routine = "repairCrossReferences "
Select Case Err.Number
Case Else
MsgBox routine _
& vbNewLine & Error(Err) _
& vbNewLine & Err.Number _
& vbNewLine & Err.Description _
& vbNewLine & Err.Source
End Select
End Sub