Macros to identify the bullet list

D

Designingsally

i use a certain stylebook. I wan the macros to do the following as per the
rules in the book. The rules are


1. I want the bullets list NOT to have the word "AND". If the list has the
AND then i must get a msg box saying "change".

ex: I own a:
*car
*dog
*and cat

So when the macros encounter AND a comment box must be displayed.

Thanks for the help in advance
 
D

DaveLett

Hi,
You can use something like the following:
Dim lList As Long
With ActiveDocument
For lList = ActiveDocument.ListParagraphs.Count To 1 Step -1
With .ListParagraphs(lList).Range
Select Case True
Case InStr(1, .Text, " and ") <> 0, _
InStr(1, .Text, " and") <> 0, _
InStr(1, .Text, "and ") <> 0
Debug.Print True
.Select
ActiveDocument.Comments.Add _
Range:=Selection.Range, _
Text:="Do not use the word AND in a bulleted list."
Case Else
''' do nothing
End Select
End With
Next lList
End With

However, this routine will create false positives. For example, if any words
that start or end with "and" (for example, android, brand) are in the list
paragraphs, then they will be caught in this routine. This really points to a
more fundamental issue with what you seem to be trying to do with macros in
general (using them to catch common stylistic issues). You can use them, but
programming them to account for the decision making that we (people) have to
do for assessing language and writing is very complex.

HTH,
Dave
 
D

DaveLett

Hi,
The matchwholeword option doesn't work because the routine isn't using .Find.

Can you highlight "and" by itself? Yes, just move the range object prior to
..Select.

HTH,
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top