Usinv MSOffice Pro 2003 SP1
I want to select the first line of my document to capitalize it.
The line in the doc is not always the same length, so in my code here
that I generated with the macro recorder, line #3 uses wdCharacter and
Count:=15.
Selection.HomeKey Unit:=wdStory
Selection.EndKey Unit:=wdLine
Selection.MoveLeft Unit:=wdCharacter, Count:=15, Extend:=wdExtend
Selection.Font.AllCaps = wdToggle
What I really want is for this to select the entire line irregardless
of it's length. I was thinking to go to the end of the line and use
something like this:
Selection.MoveStartWhile cset:=" ", Count:=wdBackward
except that I don't want to move only until I hit a space, I want to
move back to the first character of the line and select all
characters.
Could you please help me solve this little issue
Much appreciation for your time and expertise
Joanne
Jonathan West - 07 Mar 2005 14:20 GMT
> Usinv MSOffice Pro 2003 SP1
> I want to select the first line of my document to capitalize it.
[quoted text clipped - 17 lines]
> Much appreciation for your time and expertise
> Joanne
Hi Joanne,
This will do th needful
Sub T()
Selection.HomeKey Unit:=wdStory
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.AllCaps = wdToggle
End Sub
But beware. Once the text has been made all caps, it might be longer than a
line.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Joanne - 07 Mar 2005 14:49 GMT
Thanks so much Jonathan, and I will beware of overflowing lines.
>> Usinv MSOffice Pro 2003 SP1
>> I want to select the first line of my document to capitalize it.
[quoted text clipped - 30 lines]
>But beware. Once the text has been made all caps, it might be longer than a
>line.