#1
|
|||
|
|||
Synonym Finder
Synonyms Finder in MS Word
Requirements
Example Text to be selected =============== A computer is a device that can be instructed to carry out sequences of arithmetic or logical operations automatically via computer programming. We cannot live without computer The synonyms for the bold/target words are following Target word: computer User defined synonyms: Processor, supercomputer, workstation, CPU MS word synonyms: Processor, microprocessor, motherboard The selection window will display the following (this is one way) Computer • Processor • Microprocessor • Motherboard o Supercomputer o Workstation o CPU After user selection Computer • Processor • Microprocessor o Motherboard o Supercomputer • Workstation o CPU Synonym Code: Code:
Sub Synonyms_List() Dim mySynObj As Object Dim SList As Variant Dim i As Long Dim 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 Dim strClipText As DataObject Dim strInputText As String Dim errCode As Integer Set strClipText = New DataObject strInputText = StrOut strClipText.SetText strInputText strClipText.PutInClipboard Documents.Add Selection.PasteAndFormat (wdFormatOriginalFormatting) End Sub Code:
Sub target_word() Selection.HomeKey Unit:=wdStory ' Selection.Find.ClearFormatting Selection.Find.Font.Bold = True Selection.Find.Execute Selection.Copy Documents.Add 'Template:="Normal", NewTemplate:=False, DocumentType:=0 Selection.PasteAndFormat (wdFormatOriginalFormatting) Selection.TypeParagraph windows(2).Activate ' Selection.Find.ClearFormatting ' Selection.Find.Font.Bold = True Do While Selection.Find.Execute Selection.Copy windows(1).Activate Selection.PasteAndFormat (wdFormatOriginalFormatting) Selection.TypeParagraph windows(2).Activate Loop End Sub |
#2
|
||||
|
||||
That will be an interesting project for you to undertake...
You might start by reading: https://www.msofficeforums.com/word/...-separate.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks Paul,
Yes this is very interesting project. But it very complex to me . Now I am find out the targeted word and find out the synonym of them. But I am stop. Before the all each synonyms need set a checkbox with the opening new document. |
#4
|
||||
|
||||
Given your extensive list of requirements, I doubt it's something anyone on a free user forum would be undertaking. Such a project would require the investment of considerable time and effort. There are plenty of coding examples here you might draw on for how to implement a userform, automate Excel from Word, and so on. It would also be a good learning exercise.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Synonym list | subrota | Word VBA | 2 | 04-16-2019 11:29 PM |
Excel Macro: Duplicate Finder | Saucy_Moonbeams | Excel Programming | 0 | 06-18-2018 04:59 AM |
Using a product key finder to transfer MS from PC to Mac - risky? | loza890 | Office | 1 | 11-02-2014 10:43 PM |
Acronym Finder | Cray_Z | Word VBA | 14 | 09-22-2014 11:42 PM |
Function Finder | Kevin18014 | Excel | 3 | 01-02-2012 04:47 PM |