View Single Post
 
Old 09-11-2012, 10:32 AM
elky1967 elky1967 is offline Windows XP Office 2003
Novice
 
Join Date: Sep 2012
Posts: 8
elky1967 is on a distinguished road
Default Delete all rows but the last.

Hi all,
First of, I'm not a VB/VBA programmer, I'm a sas programmer, so please forgive me if say something stupid.

I wrote a simple macro in Word 2003 to remove all tables from a document.

Code:
Sub Deltables()
Application.ScreenUpdating = False
 
Dim Tbl As Table
 
With ActiveDocument
  For Each Tbl In .Tables
    Tbl.delete
  Next Tbl
End With
 
Application.ScreenUpdating = True
End Sub
What i really need now is to delete every row of a table except the last one.
Since the tables have different numbers of rows is there a way to do something like...

If not tbl.last.row then delete

Thanks in advance..

Last edited by macropod; 09-11-2012 at 04:26 PM. Reason: Added code tags & formatting
Reply With Quote