M
Mat
I have a bit of code that finds tables in a document and
deletes them - it is a simple do...loop. When I run it it
loops through OK, but I get an error on the last but one
line (see below)
How can I run this macro without the error (eg how to
exit the loop/macro without an error ?
Thanks for any help ...
Mat
Do
Selection.GoTo What:=wdGoToTable, Which:=wdGoToNext,
Count:=1, Name:=""
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Tables(1).Select <<<<<< Code Error here
Selection.Tables(1).Delete
Loop
End Sub
deletes them - it is a simple do...loop. When I run it it
loops through OK, but I get an error on the last but one
line (see below)
How can I run this macro without the error (eg how to
exit the loop/macro without an error ?
Thanks for any help ...
Mat
Do
Selection.GoTo What:=wdGoToTable, Which:=wdGoToNext,
Count:=1, Name:=""
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Tables(1).Select <<<<<< Code Error here
Selection.Tables(1).Delete
Loop
End Sub