Thread: [Solved] Need Help with Below Code
View Single Post
 
Old 03-30-2014, 05:51 AM
rsrasc rsrasc is offline Windows 7 64bit Office 2010 64bit
Competent Performer
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default Can't get it right?

My preference would be to encode in a macro because I need it for approximately 60 documents that I'm editing.

Anyway, I tested but doesn't work. Would you please show me what I did wrong?

Thanks in advance!!
Cheers!


Code:
Sub Demo2()
Application.ScreenUpdating = False
With ActiveDocument.Range
  .InsertBefore " "
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchWildcards = True
    .Text = ".([0-9]{1,3}.)"
    .Replacement.Text = ". \1"
    .Execute Replace:=wdReplaceAll
    .Text = " ([a-e].)"
    .Replacement.Text = "^p\1"
    .Execute Replace:=wdReplaceAll
    .Replacement.Style = "Strong"
    .Text = " ([!1-9])[0]{1,}([0-9]{1,})"
    .Execute Replace:=wdReplaceAll
  End With
  .Characters.First.Delete
End With
Application.ScreenUpdating = True
End Sub

Last edited by macropod; 03-30-2014 at 08:56 AM. Reason: Added code tags & formatting
Reply With Quote