Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Thu, 26 Jun 2008 08:41:14 -0700 (PDT),    group: microsoft.public.word.word6-7macros        back       


Help with Macros   
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: Thu, 26 Jun 2008 08:41:14 -0700 (PDT)   author:   Cesar

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

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us