Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-28-2020, 12:35 AM
gmayor's Avatar
gmayor gmayor is offline I need to capitalize first word of every line Windows 10 I need to capitalize first word of every line Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
I need to capitalize first word of every line 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
I need to capitalize first word of every line 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft