Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Checking for Section Breaks, not Page Breaks (Word XP/VBA)

    Hi again.

    I should know this, but it's never come up until now: In VBA, how can I check to see if the cursor/selection is on or includes a section break? I was using Chr(12) in my function, but that returns True for both Section Breaks and Page Breaks.
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

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

    Re: Checking for Section Breaks, not Page Breaks (Word XP/VBA)

    If the section numbers (Index) before and after the break are the same, it's a page break, and if they're different, it's a section break.

  3. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Checking for Section Breaks, not Page Breaks (Word XP/VBA)

    If you have a selection then Selection.Sections.Count works quite well but if you have a collapsed section (cursor) then you need to work out whether you are looking forwards or backwards because I don't think VBA recognises the cursor as sitting ON a section break (whilst the interface appears to).
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

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