Solved

vba that simplifies the vocabulary in an MS Word document

Posted on 2013-01-16
8
435 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
  • 3
  • 3
  • 2
8 Comments
 
LVL 50

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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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 50

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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Like many others, we try and discourage users from printing documents unnecessarily and instead send or share them electronically. However, this doesn't always work and documents are still printed. With this simple solution, if the user tries to …
There is a feature provided by MS Word that lets you create an Table of Contents for your Word document automatically. To use this feature for other documents there are two steps involved,   1.  Prepare your document for a table of contents (he…
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

828 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