Hello,

We have a one-row, blank table appearing at the bottom of page 1 in hundreds
of documents (it is not in the footer). This was due to a conversion utility
that was used on these docs. Anyway, I need to create a macro that searches
the doc for this table but I can't use a specific table number in the tables
collection because there may be other legitimate tables in some of the
documents, either before or after the blank table. So, I need find the
one-row blank table and delete it.

Any ideas? Your time is always appreciated.

Re: Macro to find and delete specific table by fumei

fumei
Tue Mar 04 13:20:47 PST 2008

Is it the ONLY one row table? Are there many of them? Are there any
legitimate one row blank tables?

If there are NO legitimate one row tables - i.e you want to remove all one
row tables - then:

Dim aTable As Table
For Each aTable In ActiveDocument.Tables
If aTable.Rows.Count = 1 Then
aTable.Delete
End If
Next

will delete all one row tables.

Sammy wrote:
>Hello,
>
>We have a one-row, blank table appearing at the bottom of page 1 in hundreds
>of documents (it is not in the footer). This was due to a conversion utility
>that was used on these docs. Anyway, I need to create a macro that searches
>the doc for this table but I can't use a specific table number in the tables
>collection because there may be other legitimate tables in some of the
>documents, either before or after the blank table. So, I need find the
>one-row blank table and delete it.
>
>Any ideas? Your time is always appreciated.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200803/1


Re: Macro to find and delete specific table by Sammy

Sammy
Tue Mar 04 14:01:09 PST 2008

This works wonderfully, thanks.

"fumei via OfficeKB.com" wrote:

> Is it the ONLY one row table? Are there many of them? Are there any
> legitimate one row blank tables?
>
> If there are NO legitimate one row tables - i.e you want to remove all one
> row tables - then:
>
> Dim aTable As Table
> For Each aTable In ActiveDocument.Tables
> If aTable.Rows.Count = 1 Then
> aTable.Delete
> End If
> Next
>
> will delete all one row tables.
>
> Sammy wrote:
> >Hello,
> >
> >We have a one-row, blank table appearing at the bottom of page 1 in hundreds
> >of documents (it is not in the footer). This was due to a conversion utility
> >that was used on these docs. Anyway, I need to create a macro that searches
> >the doc for this table but I can't use a specific table number in the tables
> >collection because there may be other legitimate tables in some of the
> >documents, either before or after the blank table. So, I need find the
> >one-row blank table and delete it.
> >
> >Any ideas? Your time is always appreciated.
>
> --
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.aspx/word-programming/200803/1
>
>