![]() |
|
#1
|
|||
|
|||
|
I found this link which seems in the right direction; however, looking to start the proper case change after an em dash. I know the change is required in the Blue sections of the code below, but not understanding how to change it. The part about looking for the period I don't even need as there are no periods in the sentence.
Before AFMAN—AIR FORCE MANUAL AO—ACTION OFFICER CAF—CENTRAL ADJUDICATION FACILITY AFTER AFMAN—Air Force Manual AO—Action Officer CAF—Central Adjudication Facility Code:
Sub MakeTitle()
Application.ScreenUpdating = False
Dim StrTmp As String
With Selection.Range
StrTmp = Trim(.Text)
While Right(StrTmp, 1) = "."
StrTmp = Left(StrTmp, Len(StrTmp) - 1)
Wend
While InStr(StrTmp, " ") > 0
StrTmp = Replace(StrTmp, " ", " ")
Wend
StrTmp = TitleCase(StrTmp, bCaps:=False, bExcl:=False)
.Text = StrTmp
End With
Application.ScreenUpdating = True
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How do I convert a line of text to title case?
|
neilfxb | Word | 21 | 02-22-2023 12:47 PM |
| Macro that formats (true title) case by Heading style | Marrick13 | Word VBA | 11 | 09-20-2015 06:29 PM |
Customising a style that uses Title Case formatting
|
Madanjeet | Word | 6 | 05-18-2015 10:11 AM |
| Stop review query when small case at beginning of line | dsrose | Word | 2 | 01-22-2014 12:19 AM |
True Title Case for First Row of All Tables
|
Marrick13 | Word VBA | 14 | 12-11-2013 09:12 PM |