check last word

D

Designingsally

i m reposting this as a new post so that others may benefit.

i want to know if the macros can check if AND
occurs at the end of the penultimate list


Eg


I have:
* book
*car
*dog,cat,rat and ( check this and at the end of the list if and occurs in
the end it cna ignore)
*mat


if it is possible pls help me out

the code i got is


Dim oRng As Range
Set oRng = ActiveDocument.Lists(ActiveDocument.Lists.Count - 1).Range
If oRng.Find.Execute(FindText:="word") Then
oRng.Select
End If

If, however, you mean cycling through all lists in the document and
selecting a word in the penultimate item in that list, then you can use the
following:
Dim oRng As Range
Dim lLists As Long


For lLists = ActiveDocument.Lists.Count To 1 Step -1
With ActiveDocument.Lists(lLists)
Set oRng = .ListParagraphs(.ListParagraphs.Count - 1).Range
If oRng.Find.Execute(FindText:="word") Then
oRng.Select
End If
End With
Next lLists
End Sub

I believe in Hope.

DesigningSally
 
D

DaveLett

Hi,
Reposting as a new post really only serves to clutter the forums. Please
don't create new threads for these. During this week alone, you have created
8 separate posts, all of which contain replies to your query, that address
this single issue. Also, I think that I'm going to echo Greg's comments " I
can't speak for others, but I will be glad to assist you further once you
have shown a willingness to assist yourself. I don't see that."

For this issue, use the second routine that I provided and simply change the
word that is in quotation marks ("word") to the word that you're looking for
("and"). Then, use the other routine that I posted and pull the code for
adding a comment to a selection.

Dave
 
D

Designingsally

OoPs i m sorry. I think i posted my q wrongly. I m sorry for the inconvience
caused
 

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