View Single Post
  #28   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Creating a Macro

While checking I noticed another minor issue relating to the font in the
transposed numbers. The following will fix that too.

Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long
vFindText = Array("(upper right) ([0-9]{1,})", _
"(bottom right) ([0-9]{1,})", "upper left ", _
"upper right", "bottom left ", "bottom right ")
vReplText = Array("\2\1", "\2\1", ChrW(9496), _
ChrW(9492), ChrW(9488), ChrW(9484))
With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = False
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText(i)
Select Case i
Case 2
.Replacement.Font.name = "Arial"
.Replacement.Font.Size = 16
.Replacement.Font.Position = -4
Case 3
.Replacement.Font.name = "Arial"
.Replacement.Font.Size = 16
.Replacement.Font.Position = -4
Case 4
.Replacement.Font.name = "Arial"
.Replacement.Font.Size = 16
.Replacement.Font.Position = 4
Case 5
.Replacement.Font.name = "Arial"
.Replacement.Font.Size = 16
.Replacement.Font.Position = 4
Case Else
End Select
.Execute Replace:=wdReplaceAll
Next i
End With
End With
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org