Thread: [Solved] Synonym list
View Single Post
 
Old 04-16-2019, 10:50 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,374
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

That's a trivial, change. Really!
Code:
Private Sub CommandButton1_Click()

Dim mySynObj As Object
Dim SList As Variant
Dim i As Long
StrOut As String


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(mySynObj.SynonymList(1))
  StrOut = StrOut & vbCr & SList(i)
Next i
MsgBox "Synonyms for " & mySynObj.Word & " are:" & StrOut
End Sub
PS: When posting code, please use the code tags, indicated by the # button on the posting menu, and structured code. Without both, your code loses much of whatever structure it had.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote