Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Slightly Modify a Macro (Office 2000)

    Hello:

    I would like to modify the following macro so that instead of leaving random double blank spaces between words, it Replaces (Control+H) double blank spaces with single blank spaces.

    Thanks so much.

    Jonathan Rick
    JRick@hamilton.edu

    Sub FixMail()

    dowhat = wdFindStop
    If Selection.Type = wdSelectionIP Then
    Selection.HomeKey Unit:=wdStory
    dowhat = wdFindContinue
    End If
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting

    With Selection.Find
    .Text = "^p"
    .Replacement.Text = "@@@"
    .Forward = True
    .Wrap = dowhat
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    With Selection.Find
    .Text = "@@@@@@"
    .Replacement.Text = "^p^p"
    .Forward = True
    .Wrap = dowhat
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    With Selection.Find
    .Text = "@@@"
    .Replacement.Text = " "
    .Forward = True
    .Wrap = dowhat
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    End Sub

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Slightly Modify a Macro (Office 2000)

    You could add one more replace at the end, like this:

    <pre>With Selection.Find
    .Text = " "
    .Replacement.Text = " "
    .Forward = True
    .Wrap = dowhat
    End With
    Selection.Find.Execute Replace:=wdReplaceAll</pre>


Posting Permissions

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