View Single Post
 
Old 09-04-2019, 07:07 AM
subrota subrota is offline Windows 10 Office 2013
Novice
 
Join Date: Apr 2019
Posts: 11
subrota is on a distinguished road
Default How can I find my synonyms separately

Hi,
I have a paragraph and some bold word (targeted word).
I need synonym for each targeted word in a new document.

Example My Paragraph:
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).


Here my targeted words are:
layout, Content, us, many, Various, sometime


My expected outcome in a new document:
layout plan design arrangement outline draught draft blueprint
Content Gratified Happy Satisfied Contented Pleased Comfortable Relaxed At ease
........
.......


Code:
Dim mySynObj As Object
Dim Slist As Variant
Dim i As Long
Dim StrOut As String


Documents.Add
Windows(2).Activate
Selection.WholeStory
Selection.Find.Font.Bold = True

Do While Selection.Find.Execute
Selection.Copy

Set mySynObj = Selection.Range.SynonymInfo
Slist = mySynObj.SynonymList(1)
For i = 1 To UBound(mySynObj.SynonymList(1))
StrOut = StrOut & " " & Slist(i)
Next
Windows(1).Activate
Selection.Paste
Selection.TypeText Text:=StrOut
Selection.TypeParagraph
Windows(2).Activate
Loop
Attached Files
File Type: docm new-synonyms.docm (20.8 KB, 1 views)
Reply With Quote