Solved

Can I write a VBA script to operate inside Microsoft Word to find adverbs and adjectives?

Posted on 2014-11-10
4
503 Views
Last Modified: 2014-11-17
Dear Experts,
I know how to write a VBA script inside Excel to perform certain operations on a spreadsheet.

What I want to know is if I can do the same thing in Microsoft Word to perform certain operations on the Word file that I am editing.  Specifically I want to be able to find adverbs and adjectives.  There are many novel writing coaches who tell you to search for your adverbial phrases and replace them with stronger verbs.

I believe that the Microsoft grammar checker can identify adverbs and adjectives.

Is there any way to do what I am suggesting by writing something similar to a VBA script in Excel?
Best Wishes,
Philip Truscott
0
Comment
Question by:Philip-David Truscott
  • 2
4 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 40433299
If the grammar check can differentiate between adjectives and adverbs, it isn't very good at it. And even so, it keeps it to itself.

You might be able to write your own using Find with the help two lists - one of adverbs that do not end 'ly' and another of non-adverbs that do so.
0
 
LVL 28

Expert Comment

by:omgang
ID: 40433525
If your question is 'Is it possible to write a vba macro/procedure in MS Word similar to how you do so in MS Excel?' then the answer is yes.
OM Gang
0
 

Author Comment

by:Philip-David Truscott
ID: 40433991
Dear OM Gang,
Can you give more information?  Can you point to a Web page that shows how to create a macro in a similar way to Excel and debug into the  Macro within Microsoft word?
Best Wishes,
Phil Truscott
0
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 40437641
For Word 2010, start off by enabling/displaying the Developer tab in the Ribbon.
File menu -> Options -> Customize the Ribbon (left pane) -> on the right side of the main window put a check mark in the box for Developer.
Now that the Developer tab has been added to the Ribbon you'll see a Record Macro ribbon option similar to Excel.

To view/display the VBE (Visual Basic Editor) in Word you can click the Visual Basic option in the ribbon (Developer tab) or you can key Alt + F11.  Once the VBE is open you can debug just like you're familiar with in Excel.

An example of enumerating each word in the Word document - e.g. so you can test to see if it's an adjective or adverb

Dim sRange, wWord
For Each sRange In ActiveDocument.StoryRanges
    For Each wWord In sRange.Words
        'call sub to test for adjective or adverb or ???
        Debug.Print wWord
    Next
Next

Hopefully this gets you started.  Let me know if you need more.
OM Gang
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

679 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