Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Identify "various" in a bullet list.

6 views
Skip to first unread message

Designingsally

unread,
Aug 25, 2009, 7:39:02 AM8/25/09
to
3. every bullet or any list must have a lead in sentence as per the book. So
i wnt the macros to add : at the end of the lead in sentence. If the lead in
sentences has words like "various", "as follows" then i wan the macros to
identify the sentence and give a message saying AVOID.

Example:

I have a: (this is the lead in sentence, notice the end of the lead in
sentence has a COLON. And also every lead in sentence is followed by a list)
*Book
*Pen
*paper

--
I believe in Hope.

DesigningSally

DaveLett

unread,
Aug 25, 2009, 9:11:01 AM8/25/09
to
Hi,
Again, I think there are too many choices to make to make a routine like
this useful. The following routine does exactly what you've asked for.
However, if your writer has something like the following, then the routine
will insert a colon after the lead-in sentence:
I have a :

Also, the routine puts the "AVOID" comment on the whole lead-in sentence,
not just the words that you want to avoid.

Dim lList As Long
Dim oRng As Range

For lList = ActiveDocument.Lists.Count To 1 Step -1
Set oRng = ActiveDocument.Lists(lList).ListParagraphs(1).Range
With oRng
.Collapse Direction:=wdCollapseStart
.MoveStart Unit:=wdSentence, Count:=-1
.MoveEnd Unit:=wdCharacter, Count:=-1
If .Characters.Last <> ":" Then
.InsertAfter Text:=":"
End If
If InStr(1, .Text, "various") Or InStr(1, .Text, "as follows") Then
ActiveDocument.Comments.Add Range:=oRng, Text:="AVOID"
End If
End With
Next lList

HTH,
Dave

Designingsally

unread,
Aug 25, 2009, 11:11:02 AM8/25/09
to

Dave

I want various and as follows to be highlighted in the comment box. Is that
possible?

Let me know.


--
I believe in Hope.

DesigningSally

DaveLett

unread,
Aug 25, 2009, 11:52:02 AM8/25/09
to
Hi,
Yes, you can have only various or as follows highlighted. You should break
this line:

If InStr(1, .Text, "various") Or InStr(1, .Text, "as follows") Then
into two If, then structures and move the range object in each structure to
be your words. Because you're going to insert the same comment for each,
you'll need to have the line:

ActiveDocument.Comments.Add Range:=oRng, Text:="AVOID"
in both If/then. If you think you'll be using this for more than just these
two words/phrases, I'd recommend that you make this a function that receives
a string from a calling routine.

Dave

Designingsally

unread,
Aug 26, 2009, 1:11:20 AM8/26/09
to

dave i tired this didnt work. can u help me out?

Sub jf()

Dim lList As Long
Dim oRng As Range

For lList = ActiveDocument.Lists.Count To 1 Step -1
Set oRng = ActiveDocument.Lists(lList).ListParagraphs(1).Range
With oRng
.Collapse Direction:=wdCollapseStart
.MoveStart Unit:=wdSentence, Count:=-1
.MoveEnd Unit:=wdCharacter, Count:=-1
If .Characters.Last <> ":" Then
.InsertAfter Text:=":"
End If

If InStr(1, .Text, "various") Then
ActiveDocument.comments.Add Range:=oRng, Text:="AVOID"
If InStr(1, .Text, "as follows") Then
ActiveDocument.comments.Add Range:=oRng, Text:="AVOID"


End If
End If
End With
Next lList


End Sub

0 new messages