View Single Post
 
Old 08-27-2023, 04:53 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,163
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This code selects the current word. If the word is followed by a space it also selects that. If it is followed by punctuation, it doesn't select the punctuation.
Code:
Sub GetIt()
  Dim aWord As Range
  Set aWord = Selection.Words(1)
  aWord.Select
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote