Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Range Ranger (Word 97SR2)

    Hello. My name is Kevin. I am range challenged.

    I want to create a range the consists of all the sentences in a paragraph except the first sentence.

    Something akin to this:
    Set aRng = aPara.Range.Sentences(2-LCount).FormattedText

    That won't work, of course, but how do I get what I want?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

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

    Re: Range Ranger (Word 97SR2)

    Kevin,

    Something like this...
    <pre>Dim rngText As Range
    Set rngText = Selection.Paragraphs(1).Range.Duplicate
    rngText.MoveStart unit:=wdSentence, Count:=1
    </pre>

    You should probably check for at least two sentences, otherwise you'll move the range to the next paragraph.

    StuartR

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Range Ranger (Word 97SR2)

    Stuart,
    This is good. The key is that MoveStart method. But, a question.

    Why do you use the duplicate method?

    edited: it's not a method. It's a property. Oey!
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Range Ranger (Word 97SR2)

    I think I get it. You don't want to accidentally change the original range. Hence duplicate.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

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

    Re: Range Ranger (Word 97SR2)

    > You don't want to accidentally change the original range. Hence duplicate.
    Spot on <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>
    In this particular case, the original range was selection.paragraphs(1).range so there is no risk, but it is a good habit to get into.

    StuartR

Posting Permissions

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