Thread: [Solved] Synonym list
View Single Post
 
Old 04-16-2019, 09:54 PM
subrota subrota is offline Windows 10 Office 2013
Novice
 
Join Date: Apr 2019
Posts: 11
subrota is on a distinguished road
Default Synonym list

I want all synonyms with a list inside a text box in a user form for a word from a paragraph. But it shows one by one with the msgbox.



Code:
Private Sub CommandButton1_Click()

Dim mySynObj As Object
Dim SList As Variant
Dim i As Variant

Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend




Set mySynObj = Selection.Range.SynonymInfo
SList = mySynObj.SynonymList(1)
For i = 1 To UBound(SList)
  MsgBox "A synonym for " & mySynObj.Word _
   & " is " & SList(i)
Next i
End Sub
Attached Files
File Type: docm Synonym List.docm (16.6 KB, 7 views)

Last edited by macropod; 04-16-2019 at 10:45 PM. Reason: Added code tags & formatting
Reply With Quote