Consulting

Results 1 to 7 of 7

Thread: Newbie still learning - Help with VBA code to capitalize last line of addresses

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    In that case you could use a macro like:
    Sub Demo()
    Application.ScreenUpdating = False
    Dim i As Long
    With ActiveDocument.Range
      With .Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = "[!^13^11]@<[A-Z]{2,3} [0-9]{4}"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchWildcards = True
        .Execute
      End With
      Do While .Find.Found
        i = i + 1
        .Text = UCase(.Text)
        .Collapse wdCollapseEnd
        .Find.Execute
      Loop
    End With
    Application.ScreenUpdating = True
    MsgBox i & " records processed."
    End Sub
    Last edited by macropod; 11-07-2014 at 10:08 PM.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •