![]() |
|
#3
|
||||
|
||||
|
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 |
| Tags |
| selecting text |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Cursor location on first click -- insertion point
|
stevec5088 | Word | 1 | 12-14-2016 02:45 PM |
Move Insertion Point with VBA
|
Grasor | Word VBA | 2 | 10-11-2016 08:50 PM |
| Word 2013 Insertion Point stops blinking | NeilSC | Word | 0 | 12-13-2013 12:19 PM |
Insertion point not working
|
pmahoney14 | Word | 1 | 05-24-2012 04:17 PM |
wildly flashing insertion point with spinning wheel
|
joannetk | Word | 4 | 03-10-2011 04:26 AM |