![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#2
|
|||
|
|||
|
Hi! Since "-" is a word, try the following basic code (without the exclusion check):
Code:
Sub Test()
Dim para As Paragraph
Dim oWd As range
Application.ScreenUpdating = False
For Each para In ActiveDocument.range.Paragraphs
If para.Style = "Heading 1" _
Or para.Style = "Heading 2" _
Or para.Style = "Heading 3" _
Or para.Style = "Report Title" _
Or para.Style = "Report Subtitle" _
Or para.Style = "Figure/Table Title" Then
For Each oWd In para.range.words
oWd.Select
If oWd = "-" Or oWd = "(" Then
selection.Characters.Last.Next = UCase(selection.Characters.Last.Next)
End If
Next oWd
End If
Next para
Application.ScreenUpdating = True
End Sub
|
| Tags |
| capitalization, hyphenation |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Replace any UK Words to US words in the entire document | laith93 | Word VBA | 4 | 12-25-2023 01:56 AM |
Macro to insert certain words if the number of words than 20
|
laith93 | Word VBA | 6 | 10-28-2022 01:12 AM |
| How to find (highlight) two and more words in a list of 75k single words in Word 2010 | Usora | Word | 8 | 05-29-2018 03:34 AM |
How to mark underlined words in a sentence as A, B, C, D (beneath the words)
|
thudangky | Word | 13 | 12-12-2013 02:22 AM |
| Why Words doesn’t show the style of the selected words automatically???? | Jamal NUMAN | Word | 0 | 04-14-2011 03:20 PM |