Results 1 to 4 of 4

Thread: Title Case bug?

  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

    Title Case bug?

    There is an apparent Design Feature (tm) in Word97 whereby text that has been typed in with the CapsLock key on (and hence is in upper-case alphabetics) cannot be coerced into Title case until the case is removed.


    I suspect that Harold tested the first character of the range and if it was already an upper-case, shrugged and said "obviously there's nothing to be done here".

    I hope they fired Harold.

    I discover that if I select the "URS" of "THURSDAY" and run my macro, it will NOT capitalise the "U", presumably because the character to the left is alphabetic, and therefore we cannot title-case a "word". How annoying if I'm dealing with part-numbers, where "123abc456" ought to be written as "123ABC456".

    I note too that execution of the first rng.Case when called from SetTitleCaseParagraph() causes the selection point to move to the end of the paragraph.

    Odd!!

    I thought that the use of Ranges was supposed to be good because it did NOT affect the selection point. Obviously I need to read more about Design Features. And no, I did those two upper-case letters by HAND!


    <pre>Public Function intSetTitleCase(rng As Range) As Integer
    ' Procedure : intSetTitleCase
    ' Description: Gets around an apparent bug in Word97.
    ' By: Chris Greaves Inc.
    ' Inputs: RANGE of text.
    ' Returns: INTEGER original case setting.
    ' Assumes: None.
    ' Side Effects: None.
    ' Tested: By the calls from Sub TitleCase.

    intSetTitleCase = rng.Case ' return the original case of the text.
    rng.Case = wdLowerCase ' go to LowerCase
    rng.Case = wdTitleWord ' and only then try for Title case
    'Sub TESTintSetTitleCase()
    ' MsgBox intSetTitleCase(Selection.Range)
    'End Sub
    End Function
    </pre>




    <pre>Public Sub SetTitleCase()
    Call intSetTitleCase(Selection.Range)
    End Sub
    Public Sub SetTitleCaseParagraph()
    Call intSetTitleCase(Selection.Paragraphs(1).Range)
    End Sub
    </pre>


    A better version of SetTitleCaseParagraph() would identify short words (such as "and" and "the" and "etc." etc.) which are unlikely to require capitalization.

  2. #2
    kelliel
    Guest

    Re: Title Case bug?

    Your initial assumption, "text that has been typed in with the CapsLock key on (and hence is in upper-case alphabetics) cannot be coerced into Title case," I have not found to be true.

    In fact, I typed these words:

    <pre>THIS IS TYPED WITH CAPS LOCK ON</pre>


    Selected them and pressed Shift-F3. The first time, I got:

    <pre>this is typed with caps lock on</pre>


    The second time:

    <pre>This Is Typed With Caps Lock On</pre>



    Now, I will, however, point out that if you try the following:

    <pre>THIS IS TYPED WITH CAPS LOCK ON.</pre>


    You get this:

    <pre>this is typed with caps lock on.</pre>


    and this

    <pre>This is typed with caps lock on.</pre>


    That is because of the period at the end of the sentence. I included it in the selection.

    So, I have found that if you include ending punctuation (period, question mark, exclamation mark, etc.) with your selection and try to change case, it will go into Title Case, via keystroke.

    However via the Change Case dialog box, it works.

  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

    Re: Title Case bug?

    Hmmm. I shot off my mouth too quickly.

    I'll have to do more reserach. It does seem that the Title Case action depends somewhat on what is selected, no?

  4. #4
    kelliel
    Guest

    Re: Title Case bug?

    Correct, to your last question.

Posting Permissions

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