Find Synonyms for a word in MS Excel using VBA

raghuram.star

Board Regular
Joined
Sep 5, 2012
Messages
102
Can you please help me find the Synonyms for a word in a given range

Like Each cell in Range A1:A5 has single word, in Range B1:B5 need to polulate Synonyms or Meaning of the word, like the option available in MS Word.

For example Cell A1 has word Organization which has following synonyms identified by default in MS Word
Organization = Group, Society, Institute, Association, Union, Business

Similarly I need to pick Max 3 Synonyms for any given word.

Word
Synonym
OrganizationGroup, Society, Institute
MotorEngine, Motorized, Motor-powered
UniverseCosmos, World, Creation
CollegeSchool, University, Academy
WebMesh, Net, Netting

<colgroup><col><col></colgroup><tbody>
</tbody>

Below is the code I found to get Synonyms for a word in MS Word, but no luck in MS Excel yet.
Code:
Sub GetSynonyms()
    Dim msg As String
    Dim var
    Dim i As Long
    Dim mySi As SynonymInfo
    Dim synList() As String
    
    Selection.Expand Unit:=wdWord
    Set mySi = Selection.Range.SynonymInfo
    For var = 1 To 1
        synList = mySi.SynonymList(Meaning:=var)
        For i = 1 To 3
            iSynonyms = iSynonyms & synList(i) & ", "
        Next i
    Next
    Debug.Print iSynonyms
End Sub

Is there any equivalent vba code in MS Excel?

Please help
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Can't you just use VLookup?

EDIT, I've just re-read the question, no, there isn't you'll need to use word, though you can control word from excel
 
Upvote 0
maybe you can trigger Shift + F7, though whether its searchable or not I've never tried
 
Upvote 0

Forum statistics

Threads
1,220,987
Messages
6,157,239
Members
451,407
Latest member
vdaesety

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top