?
Solved

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

Posted on 2014-11-10
4
Medium Priority
?
523 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
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 …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

762 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