Solved

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article will show you how to use shortcut menus in the Access run-time environment.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

791 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