![]() |
|
#2
|
||||
|
||||
|
What constitutes a 'line' in the document? There are no 'lines' in a Word document. Formatting is by text flow between the current margins. If the 'lines' are merely an artefact of text flow then capitalising the first Word on each displayed line is likely to reflow the document as Capitals can take up more space then the lower case letters they replace.
If the 'lines' are actually paragraphs then the matter is rather more straightforward. Code:
Dim oPara As Paragraph
For Each oPara In ActiveDocument.Paragraphs
oPara.Range.Characters(1).Case = wdUpperCase
Next oPara
Set oPara = Nothing
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Capitalize one to two words if they are the only words on a line
|
jrhlavac | Word VBA | 1 | 10-08-2015 08:19 PM |
| Create exceptions to the "Capitalize Each Word" command | TonyTyner@comcast.net | PowerPoint | 0 | 03-13-2015 09:13 AM |
| Newbie - Need help with VBA code to capitalize last line of addresses | jjreg | Word VBA | 2 | 11-07-2014 10:19 PM |
Only Capitalize First Letter & Delete Last Name
|
zulhfreelancer | Excel | 5 | 12-10-2012 07:51 AM |
| capitalize first letter of sentences | norco1 | Word | 0 | 06-25-2006 12:37 PM |