Solved

vba that simplifies the vocabulary in an MS Word document

Posted on 2013-01-16
8
425 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 49

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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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 49

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…

776 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