Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 09-05-2019, 09:42 AM
gmaxey gmaxey is offline How can I find my synonyms separately Windows 10 How can I find my synonyms separately Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub ExtractSynonyms()
Dim oSynInfo As Object
Dim varList As Variant
Dim lngIndex As Long, lngSyn As Long
Dim strSyns As String
Dim oDoc As Document, oDocReport As Document
Dim oRng As Range
Dim arrList() As String
Dim oDic As Object
  Set oDic = CreateObject("Scripting.Dictionary")
  Set oDoc = ActiveDocument
  Set oDocReport = Documents.Add
  Set oRng = oDoc.Range
  arrList = Split("layout|Content|many|Various|sometimes|use", "|")
  Set oRng = oDoc.Range
  With oRng.Find
    .Font.Bold = True
    While .Execute
      If Not oDic.Exists(oRng.Text) Then
        oDic.Add oRng.Text, oRng.Text
        strSyns = oRng.Text & " - "
        Set oSynInfo = oRng.SynonymInfo
        varList = oSynInfo.SynonymList(1)
        For lngSyn = 1 To UBound(oSynInfo.SynonymList(1))
          strSyns = strSyns & " " & varList(lngSyn)
        Next
        oRng.Collapse wdCollapseEnd
        oDocReport.Range.InsertAfter strSyns & vbCr & vbCr
      End If
    Wend
  End With
  oDocReport.Activate
  Set oRng = Nothing: Set oDic = Nothing
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to trigger animations separately ? mj2000 PowerPoint 0 02-06-2019 10:10 AM
How can I find my synonyms separately How to write chapters separately with corresponding heading numbering bluejasmine Word 3 07-15-2018 07:21 AM
Check for value in each cell separately Jelmer Excel 4 07-06-2017 07:43 AM
Can we buy Access separately? eeaakkat Office 2 04-04-2017 08:28 PM
How can I find my synonyms separately Useless synonyms & other spell check complaints Vervaine Word 1 12-18-2016 06:37 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft