Results 1 to 20 of 31

Thread: Solved: Extra Unwanted Page at End of Document

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #24
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,476
    Location
    Hi DB
    Here's a wee (wee; Scots dialect word meaning small or to pee) routine to get rid of the EEPs.

    [VBA]
    Sub OffWithThePees()

    'Thanks to brettdj for the Replace
    Const FntSize = 12
    MyStr = "^p"

    For i = 10 To 2 Step -1
    pilcrows = Replace(Space(i), " ", MyStr)
    DoSpace = (i-1) * FntSize
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find.Replacement.ParagraphFormat
    .SpaceAfter = DoSpace
    End With

    With Selection.Find
    .Text = pilcrows
    .Replacement.Text = "^p"
    .Forward = True
    .Wrap = wdFindContinue
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Next
    End Sub

    [/VBA]
    Last edited by mdmackillop; 02-26-2005 at 03:18 PM. Reason: DoSpace corrected to (i-1)

Posting Permissions

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