Solved

vba that simplifies the vocabulary in an MS Word document

Posted on 2013-01-16
8
447 Views
Last Modified: 2013-01-27
I often need to downgrade information in articles so that my students can understand them. I know there is a synonym feature in ms word when you write click a word but its a bit in convenient because it is necessary to move the mouse 3 times is it possible to either
             1.creat a macro that on a rightclick only displays a list of synonyms
              2.create a macro that provides only synonyms on a lower reading level
0
Comment
Question by:Dov_B
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 38786146
Hi,

Do you want to replace the normal contextual menu  or re-arrange it

Regards
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 250 total points
ID: 38787040
The list of synonyms isn't rated in any way, so you would have to decide for yourself what you consider to be a most suitable for your students.

This demonstrates how to get the synonym list with VBA:
Sub ListSynonyms()
    Dim synInfo As SynonymInfo
    Dim vList() As String
    Dim i As Integer
    Dim strMessage As String
    Dim m As Integer
    Set synInfo = Selection.Range.SynonymInfo
    For m = 1 To synInfo.MeaningCount
        strMessage = strMessage & vbCrLf & "*** Meaning no: " & m & _
        "(" & GetPartOfSpeech(synInfo.PartOfSpeechList(m)) & ") ***" & vbCrLf
        vList = synInfo.SynonymList(m) 'Meaning:=2)
        For i = 1 To UBound(vList)
            strMessage = strMessage & vList(i) & vbCrLf
        Next i
    Next m
    MsgBox strMessage
End Sub

Function GetPartOfSpeech(wdpos As Variant) As String ' wdpos As WdPartOfSpeech give a TypeMismatch error
         Select Case wdpos
            Case wdAdjective
                 GetPartOfSpeech = "adjective"
            Case wdNoun
                 GetPartOfSpeech = "noun"
            Case wdAdverb
                 GetPartOfSpeech = "adverb"
            Case wdVerb
                 GetPartOfSpeech = "verb"
            Case Else
                 GetPartOfSpeech = "other"
        End Select
End Function
0
 

Author Comment

by:Dov_B
ID: 38799427
I am very sorry it took so long to get back to you. Thanks ever so much for kindly sharing your expertise with me. Is it possible to get that synonym list into a contextual menu generated by a right click which replaces the normal right click shortcut menu? I don't like the normal right click menu because it requires three clicks for me to choose the replacement synonyms. Although I may appear to be slightly lazy, when you consider that I am processing a huge amount of words to be simplified with easier synonyms every click counts
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 250 total points
ID: 38800770
We could add an item to the context menu, with some code like this:
Sub ContextSub()
    Dim cb As CommandBar
    Dim cbb As CommandBarButton
   
    CustomizationContext = NormalTemplate
    Set cb = CommandBars("Text")
    Set cbb = cb.FindControl(Tag:="List Synonyms")
    If cbb Is Nothing Then
        Set cbb = cb.Controls.Add(Type:=msoControlButton, _
            Before:=9, Temporary:=True)
       
        With cbb
            .Caption = "&List Synonyms"
            .Tag = "List Synonyms"
            .OnAction = "ListSynonyms"
        End With
    End If
End Sub

Open in new window

but, at best, that wouldn't save you any clicks. To do that, we would need at add each synonym to the context menu, with the OnAction set to a macro for that particular synonym.

Perhaps it would be better to use Find and Replace instead.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 38800894
Another suggestion is to use an Exclusion dictionary. Words in such a list will be flagged as spelling errors even though they are, in fact, spelt correctly. Then when you find the first instance, you can type in the simpler word and select Change All.
0
 
LVL 51

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 250 total points
ID: 38808830
Hi,

I've created a template file, that you can use, as an add-in, to solve your problem.

Please put this file in your startup folder
ReplaceWithSynonym.dot

(how-to here: http://word.tips.net/T001602_Folder_Locations_for_Add-Ins.html)

To toggle between SynonymSearch state and normal context menu, use Alt-Strg-A

if you want to re-fire the macro (after a macro bug, for example), use Alt-Strg-Y

Please tell me your Word version, if you want help to use the template as an add-in.

http://office.microsoft.com/en-us/powerpoint-help/view-manage-and-install-add-ins-in-office-programs-HA010354315.aspx
WordAddInsThere select "Word Add-Ins" Go...

Then by Global Templates and Add-Ins you have to add the template

Regards
0
 

Author Comment

by:Dov_B
ID: 38824302
Dear Grahamskan and Rgonzo1971 you are angels may you be blessed with everything Good!
0
 

Author Closing Comment

by:Dov_B
ID: 38824311
Yes I wish I could both of you more points
I can never figure out how to ask a related question I would like to work on this project by asking related questions in any event it puts your synonims into one column which smetimes goes beyond the length of the screen How can Iget the shortcut menu to break up the words into multiple columns?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question