Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2005

Tip: Looking for answers? Try searching our database.

selecting one line

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joanne - 07 Mar 2005 14:12 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.