#1
|
|||
|
|||
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 Last edited by macropod; 04-16-2019 at 10:45 PM. Reason: Added code tags & formatting |
#2
|
||||
|
||||
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
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks a lot Edstein
It works perfectly. Thanks Again. |
Tags |
synonym list |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to import list from Excel into drop-down list into word | ahw | Word VBA | 43 | 02-28-2020 08:11 PM |
Task list checkboxes appear solid black when I print list | mechitar | Outlook | 0 | 10-24-2018 09:06 AM |
Attempting to mail merge one list into a document containing 3 pages - each page needs the same list | LisaRH | Mail Merge | 3 | 08-09-2018 03:01 PM |
Word 2013 question - master list current list | markecb | Word | 6 | 02-28-2016 01:51 AM |
List Style Numbering picks up out of order number from LATER list | spthomas | Word | 12 | 12-16-2013 05:23 PM |