I want a macro I am working on to select a word. The VBA statement
Selection.Expand wdWord
will select the word, but it also includes the following space, which I don’t want. I have been unable to figure out how to write the statement to select a word without the following space but also select the word if it is followed by punctuation. For example, I would like the macro to select only the letters “hand” in the following two examples:
hand-carved
hand carved
Ultimately, I want to create a VBA macro that will work similar to Word’s Add to Dictionary feature except that it will bring up dialog box that allows me to choose which dictionary to add the word to. Until I can figure out how to write the whole macro in VBA, I am doing a patch job with some things in VBA and some in Macro Express. Currently, thanks to the help you have given, I have added to the context-sensitive menus Add to Custom Dictionary which activates a VBA macro that calls the Macro Express macro to copy the selected word, bring up a menu listing my custom dictionaries from which I can choose the dictionary to add the word to, opens the dictionary and pastes the word, saves the file, and reloads the dictionaries.
What I haven’t been able to do is place my cursor in the word, right-click to select Add to Custom Dictionary and have the word where my cursor is selected, copied, and if Word indicates it is a misspelled word, choose Ignore All, before proceeding to call the Macro Express macro. Thus my question about selecting just the characters of the word. Right now, I have to first click Ignore All and then I have to manually select the word/characters to be copied before right-clicking and selecting Add to Custom Dictionary.
Thanks for your help.