Results 1 to 15 of 15
  1. #1
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change all page breaks for next page breaks (2003)

    Hi,

    Is there a way with code to open a word doc and change all 'page breaks' in the document to 'next page' section breaks.

    I no how to automate opening the files, but dont know how to change the exsiting 'page breaks'

    Many thanks
    Kevin
    Regards
    Gerbil (AKA Kevin)

  2. #2
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Change all page breaks for next page breaks (2003)

    Try the following but be cautious This also converts continuous section breaks.
    <div style="width: 100%; background-color: #FFFFFF;"><code><font color=black><font color=blue>Sub</font color=blue> ReplacePgBrk_W_SectBrk()
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    <font color=blue>With</font color=blue> Selection.Find
    .Text = "^12"
    .Replacement.Text = ""
    .Forward = <font color=blue>True</font color=blue>
    .Wrap = wdFindStop
    .Format = <font color=blue>False</font color=blue>
    .MatchCase = <font color=blue>False</font color=blue>
    .MatchWholeWord = <font color=blue>False</font color=blue>
    .MatchWildcards = <font color=blue>False</font color=blue>
    .MatchSoundsLike = <font color=blue>False</font color=blue>
    .MatchAllWordForms = <font color=blue>False</font color=blue>
    <font color=blue>End</font color=blue> <font color=blue>With</font color=blue>
    <font color=blue>Do</font color=blue> <font color=blue>While</font color=blue> Selection.Find.Execute
    Selection.InsertBreak Type:=wdSectionBreakNextPage
    Selection.Delete Unit:=wdCharacter, Count:=1
    <font color=blue>Loop</font color=blue>
    <font color=blue>End</font color=blue> <font color=blue>Sub</font color=blue>
    </font color=black></code></div hiblock>
    Regards
    Don

  3. #3
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Change all page breaks for next page breaks (2003)

    OOPS!!

    In my previous post, replace the line:
    .Text = "^12"

    With
    .Text = "^m"

    And disregard the caution.
    Regards
    Don

  4. #4
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change all page breaks for next page breaks (2003)

    Thank you, exactly what I needed
    Regards
    Gerbil (AKA Kevin)

  5. #5
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change all page breaks for next page breaks (2003)

    Can I also use this macro to change the type face and size to Arial 11

    Thanks
    Regards
    Gerbil (AKA Kevin)

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

    Re: Change all page breaks for next page breaks (2003)

    What's the use of changing the type face and font size of a page break?

  7. #7
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Change all page breaks for next page breaks (2003)

    The attached code provides two possible approaches.

    H.T.H.
    Attached Files Attached Files
    Regards
    Don

  8. #8
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change all page breaks for next page breaks (2003)

    Sorry I wasn't clear

    I mean change the typeface and size of the document and change the page break to next page section breaks.

    Thanks

    Kevin
    Regards
    Gerbil (AKA Kevin)

  9. #9
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change all page breaks for next page breaks (2003)

    Thanks wdWells
    Regards
    Gerbil (AKA Kevin)

  10. #10
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change all page breaks for next page breaks (2003)

    Hi

    .Text = "^m"

    Does not work no page breaks etc change at all.

    .Text = "^12" but like you said it has its issues.

    Thanks
    Regards
    Gerbil (AKA Kevin)

  11. #11
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Change all page breaks for next page breaks (2003)

    Are we talking about manual or automatic page breaks?
    Regards
    Don

  12. #12
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change all page breaks for next page breaks (2003)

    Manual Page breaks.

    But there are also automatic breaks when the user types enough to go to another page.

    Thanks

    Kevin
    Regards
    Gerbil (AKA Kevin)

  13. #13
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Change all page breaks for next page breaks (2003)

    What happens when you run the Breaks procedure on the Breaks_Demo document?
    Attached Files Attached Files
    Regards
    Don

  14. #14
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change all page breaks for next page breaks (2003)

    Many thanks for the demo doc.

    Oddly it works this time. I set it back from 12 to m and it worked, I must have made a typo earlier I'm so sorry to have waisted your time I really appriecate your help.

    Thank you

    Kevin
    Regards
    Gerbil (AKA Kevin)

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

    Re: Change all page breaks for next page breaks (2003)

    Many a man's waist goes to waste in time... <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

Posting Permissions

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