How do we refer Synonym for a word usually?
To view synonym of a text in MS Word,
- We have to place the cursor on the word, then
- Right click to get the popup menu and
- Select option “Synonym”.
Wouldn’t it be nice if we have a keyboard shortcut, to quickly refer the meaning for a word? And also learn bit of MS Word VBA code.
Wand and the Spell
Let’s write a macro to display all possible synonyms for a word. Then assign it to a short cut key, so that anyone can use it easily.
To write a VBA code in MS word, press Alt + F11 to get to VB editor. Then copy paste the below code.Visual Basic12345678910111213141516171819Sub Get_Synonym()'''''Define VariablesDim sText As StringDim sList As String'''''Assign selected Text to VariablesText = Selection.Text'''''Get All Synonym For the Selected TextFor i = 1 To Application.SynonymInfo(sText).MeaningCountsList = sList & Application.SynonymInfo(sText).MeaningList(i) & ", "Next i'''''Display List of Sysnonyms to UsersList = sList & Application.SynonymInfo(sText).MeaningCountMsgBox sListEnd Sub
Do not run this code directly by pressing F5. We have to map this macro to a Keyboard shortcut, as explained below.
Also Read: Excel VBA - Convert Column Letter to Number
Assign Macro to Keyboard Shortcut
The explanation looks bit lengthier. But, you just have to browse through only few settings page to complete this process.
- Go to Menu File -> Word Options -> Customize -> Keyboard Shortcuts Customize.
- Popup for “Keyboard Customize” settings will be displayed.
- Select “Macro” from the Categories. It will display all macros in current workbook.
- Click on Macro “Get_Synonym” which we just copy pasted from this page.
- Click on Text box “Press New Shortcut key” and just press ‘Control key’ and ‘Q’. Textbox will automatically display Ctrl + Q.
- Click “Assign” and then Close the Window.
Read Also: How to Record Macro in Office Excel?
We have finished assigning the Macro to Keyboard shortcut Ctrl + Q. Now go to the word document.
Type any word (Example: Office). Select this word and then press Ctrl + Q. A Message box will appear with all synonyms available with MS Word.
Additional Reference: How to customize Keyboard Shortcut?
Previous Post: Excel VBA – Shutdown Computer – Logoff User – Visual Basic Code
Next Post: Password Protect Excel 2010 & 2007
Find Synonym for Selected Text using MS Word VBA
- Games VCF Countif Record Macro Timer in Excel Task Manager print screen HTML Table Import Data Thumbnails Text to Speech TTS Candy Crush Block Apps in FaceBook C++ Programing Machine learning AI bulk email Excel VBA vba color index vba color codes Android social media Twitter Google+ Google Adsense Tips bitcoin Calendar in Excel outlook vba mass email Data Mining Excel Macro Facebook WhatsApp python Wordpress