View Single Post
 
Old 08-27-2023, 11:07 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,137
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

The following should select the word the cursor is in, plus any following punctuation and sets the next character as upper case. You can add to the punctuation as required.

Code:
Sub Macro1()
Const sList As String = " ,.!?"
Dim oWord As Range
    Set oWord = Selection.Words(1)
    With oWord
        .MoveEndWhile sList
        .Text = ""
        .End = .End + 1
        .Case = wdUpperCase
    End With
    Set oWord = Nothing
End Sub
__________________
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