Solved

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

Posted on 2014-11-10
4
489 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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 article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
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…

816 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

11 Experts available now in Live!

Get 1:1 Help Now