Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The PowerPoint 2000 screen shot shows the text cursor sitting between two characters in a paragraph in a text frame.
    The length of the selection (in characters) is therefore zero.
    The VBA expression "ActiveWindow.Selection.TextRange.Paragraphs.Count " returns a value of ZERO.
    Extending the selection to hold 1, 2 or more characters causes "ActiveWindow.Selection.TextRange.Paragraphs.Count " to returns a value of ONE.

    My surmise is that Harold figured that if no characters were selected, then surely no lines, sentences or paragraphs could be selected, therefore the counts should be returned as ZERO
    The .ShapeRange.Count however is ONE for a zero-length selection of characters!

    OK.
    Perhaps the original program designer said so, and it's not really Harold's fault.
    Maybe it really is "by (poor) design", or at least, by non-intuitive design.


    I am left thinking that as I drill down through a presentation's objects - slides, shapes, paragraphs, sentences, lines, words etc. I should treat a count of ZERO as meaning ONE for the immediately superior container.

    That is:
    If ActiveWindow.Selection.TextRange.Characters.Count = 0 then
    .Words.Count=1 and .Lines.Count=1 and .Selection.Count=1 and .Paragraphs.Count=1
    regardless of what VBA says.

    Likewise:
    If ActiveWindow.Selection.TextRange.Words.Count = 0 then
    .Lines.Count=1 and .Sentences.Count=1 and .Paragraphs.Count=1
    regardless of what VBA says.

    Likewise:
    If ActiveWindow.Selection.TextRange.Lines.Count = 0 then
    .Sentences.Count=1 and .Paragraphs.Count=1
    regardless of what VBA says.

    Likewise:
    If ActiveWindow.Selection.TextRange.Sentences.Count = 0 then
    .Paragraphs.Count=1
    regardless of what VBA says.
    Attached Images Attached Images
    • File Type: jpg 1.JPG (19.2 KB, 2 views)

  2. #2
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts
    should treat a count of ZERO as meaning ONE for the immediately superior container..
    Except the parent of a textrange selection ISN'T a sentence or paragraph it's the textframe and it's parent is the shape. Hence shape count = 1

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by JohnWilson View Post
    ... and its parent is the shape. Hence shape count = 1
    John, a challenging (for me) reply, and Thank You.
    I had to go away and think about it for a bit.
    I agree, the Shape Count should be 1.

    I am left still thinking that (for consistency) for the zero-length character selection, the Word, Sentence and Paragraph Counts should be returned as 1.
    I know that Words, Sentences and Paragraphs are a different species from Shapes, but it still seems to me that returning a count of 1 for a larger "thing" should be a consistent policy.

  4. #4
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by chrisgreaves View Post
    John, a challenging (for me) reply, and Thank You.
    I had to go away and think about it for a bit.
    I agree, the Shape Count should be 1.

    I am left still thinking that (for consistency) for the zero-length character selection, the Word, Sentence and Paragraph Counts should be returned as 1.
    I know that Words, Sentences and Paragraphs are a different species from Shapes, but it still seems to me that returning a count of 1 for a larger "thing" should be a consistent policy.
    The selection is ONE shape containing a textframe, the contained textrange has No words, No paragraphs, No characters, that makes sense to me.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by JohnWilson View Post
    The selection is ONE shape ...
    John , next time please use a piece of 6x4 instead of the 4x2 that normally suffices for me.
    It finally dawned on me when I re-viewed my own screenshot.
    The SHAPE is selected. There are the little white selection handles that everyone except me could see.

Posting Permissions

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