Solved

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

705 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