View Single Post
 
Old 08-27-2023, 03:25 PM
wardw wardw is offline Windows 7 64bit Office 2007
Advanced Beginner
 
Join Date: Oct 2012
Posts: 65
wardw is on a distinguished road
Default How to select the word the insertion point is in?

I'd like to create a macro that deletes the word the insertion point is in plus any punctuation after it, then capitalizes the word after that. E.g., "However, frogs are in the pond" changes to "Frogs are in the pond". Foolishly, I tried to get ChatGPT to write the macro, which deteriorated into constant errors and time wasted. It couldn't seem to select the word the insertion point was in, plus the following punctuation. It kept overshooting or undershooting.

I checked some VBA info on selecting text, but couldn't find how to select just the word the insertion point is in. Is there a piece of VBA code that can do that?
Reply With Quote