Home |
Search |
Today's Posts |
#29
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Creating a Macro
This macro will drive me crazy yet
The arrays now introduce an extra space in two of the substitutions ..... aaaaagh! Use 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)) instead -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: 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 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating a custom Macro in 07 | Microsoft Word Help | |||
creating a macro | Microsoft Word Help | |||
Creating a macro | Page Layout | |||
creating a macro | New Users | |||
I need help creating a macro to use for a big network. | Microsoft Word Help |