#1
|
|||
|
|||
Converting casing in MS word
The code below converts words in a specific style into title case, except for acronyms.
However, there are specific words that I would like to add for the exception and these words should stay in lower case format (and, for, but, etc.) So far, this is what I came up with and currently not working: Public Sub TitleCaseDocument() Dim myDoc As Document: Set myDoc = ActiveDocument Dim myPara As Word.Paragraph For Each myPara In myDoc.StoryRanges.Item(wdMainTextStory).Paragraphs If myPara.Style.NameLocal = "K Level 1" Then TitleParagraph myPara End If Next End Sub Public Sub TitleParagraph(ByVal ipPara As Word.Paragraph) Dim myText As Range Dim Strtext As String Strtext = "and,of" For Each myText In ipPara.Range.Words If Not UCase$(myText.Text) = myText.Text Then myText.Words.Item(1).Case = wdTitleWord Else If Not Strtext = myText.Text Then myText.Words.Item(1).Case = wdTitleWord End If Next End Sub |
#2
|
||||
|
||||
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Quote:
|
#4
|
||||
|
||||
Maybe you should read the whole thread more closely - it gives a complete solution.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
case, ms word 2013, vba |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Corrupted word documents after converting pdf files to word | The Balf | Word | 3 | 04-24-2017 12:02 PM |
Converting a PDF to Word | jeffreybrown | Word | 2 | 05-03-2016 03:06 PM |
Converting an orignal word file from xml, back to word | Diane P | Word | 1 | 07-10-2015 08:27 PM |
converting word doc to e pub | klemens swib | Word | 17 | 06-28-2013 02:59 PM |
Converting pdf... to Word ??? | admin4ever | Word | 1 | 05-27-2011 02:58 PM |