|
|
|
date: Thu, 26 Jun 2008 08:41:14 -0700 (PDT),
group: microsoft.public.word.word6-7macros
back
Re: Help with Macros
Use:
Dim myrange As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(Findtext:="Available Float", Forward:=True,
MatchWildcards:=False, Wrap:=wdFindStop) = True
Selection.Rows(1).Delete
Loop
End With
or if the phrase is likely to appear elsewhere in the document, it might be
better to use:
Dim myrange As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(Findtext:="Available Float", Forward:=True,
MatchWildcards:=False, Wrap:=wdFindStop) = True
If Selection.Information(wdWithInTable) Then
Selection.Rows(1).Delete
Else
Selection.Collapse wdCollapseEnd
End If
Loop
End With
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"Cesar" wrote in message
news:77a777f1-f69a-43e6-9105-556376498495@79g2000hsk.googlegroups.com...
>I am new into writing macros and scripts and I need help with a
> simple
> procedure.
>
> I have a word document that contains a table. The table has several
> rows and 7 columns. (The number of rows varies, but the columns are
> always 7)
>
>
> Within this table I need script that will have a certain word or
> phrase (for example: Available Float, which will always be in column
> 7). Once the word is found, I need the script to delete the whole
> row, and go to the next looking for the same ( loop ).
>
>
> I think I know how to do a macro to find the word, I just don't know
> how to continue to to the rest ( clear contents with the row, select
> the row and delete the row).
>
>
> Your help would be greatly appreciated.
>
>
> Thank you
>
date: Fri, 27 Jun 2008 06:00:10 +1000
author: Doug Robbins - Word MVP
|
|