Results 1 to 8 of 8
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Convert Page Breaks to Section Breaks (2003)

    Hi all,
    This may be an easy request for some of you, but I need a macro that will convert all page breaks in a document into Next Page Section Breaks. Is there a chance of getting some macro code from someone that I can copy into the Normal template to do this for me!
    TIA
    Regards,
    Rudi

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Convert Page Breaks to Section Breaks (2003)

    Yes:

    Sub ConvertPageBreaks()
    Selection.HomeKey Unit:=wdStory
    With Selection.Find
    .ClearFormatting
    .Text = "^m"
    Do While .Execute
    Selection.Delete
    Selection.InsertBreak Type:=wdSectionBreakNextPage
    Loop
    End With
    End Sub

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Convert Page Breaks to Section Breaks (2003)

    Thats interesting code Hans.

    i have not tried the code yet, explain these:
    1. ^m (Is this the code to find a page break?)
    2. Do While .Execute (Why the .Execute? And is this attached to the Find Method?)

    Tx again for the code!
    Regards,
    Rudi

  4. #4
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Convert Page Breaks to Section Breaks (2003)

    Tx...I will look into that further. Your explanation is clear though.
    Regards,
    Rudi

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Convert Page Breaks to Section Breaks (2003)

    > It returns True if the 'Find what' text was found, True otherwise.

    I like a function that is always True. Like a good friend!

    StuartR

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Convert Page Breaks to Section Breaks (2003)

    <img src=/S/blush.gif border=0 alt=blush width=15 height=15> Oops - thanks for noticing this. You're a true friend! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Convert Page Breaks to Section Breaks (2003)

    See <!post=Find/Replace Special Characters (Word),421558>Find/Replace Special Characters (Word)<!/post> for an overview of codes that can be used in Find/Replace.

    Execute is a method of the Find object. It returns True if the 'Find what' text was found, True otherwise. The Do While .Execute ... Loop repeats the search until the 'Find what' text is not found any more.

    See the built-in help for more info.

    Added: it should be: It returns True if the 'Find what' text was found, False otherwise. Thanks to StuartR for pointing out my mistake.

  8. #8
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Convert Page Breaks to Section Breaks (2003)

    <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>... Maybe I should have said: Tx...I will look into that further. Your explanation is true though.
    Regards,
    Rudi

Posting Permissions

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