Solved

vba that simplifies the vocabulary in an MS Word document

Posted on 2013-01-16
8
396 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 48

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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 48

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
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 video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now