S
stevewy
I have some addresses and contact details which have been churned out
by a database program, and I need to put them into a mail-mergable
format. It was originally extracted as RTF, but now it is in Word, I
find that each record is in its own little table, along with some
unwanted details.
I am trying to write a short macro that would go through each table in
the document in turn, and if it detects there are more than seven rows
in the table (not all the records are the same length), it will delete
row 7 of the table, then move on to the next table.
I have a basic structure for doing things to each table in a document:
Sub Table_Stuff()
Dim t As Table
For Each t In ActiveDocument.Tables
With t
[stuff to do in the table]
End With
Next
End Sub
.... but I cannot get the macro to delete row 7. Now, since not all
tables have seven rows, I first need to ascertain this by using, I
presume, Selection.Information(wdMaximumNumberOfRows). However, I
can't think of how to adapt this command for use in this macro.
I tried:
t.Information(wdMaximumNumberOfRows)
but that doesn't work.
Can anyone give me any suggestions?
Thanks so much.
Steve Wylie
Kent, England
by a database program, and I need to put them into a mail-mergable
format. It was originally extracted as RTF, but now it is in Word, I
find that each record is in its own little table, along with some
unwanted details.
I am trying to write a short macro that would go through each table in
the document in turn, and if it detects there are more than seven rows
in the table (not all the records are the same length), it will delete
row 7 of the table, then move on to the next table.
I have a basic structure for doing things to each table in a document:
Sub Table_Stuff()
Dim t As Table
For Each t In ActiveDocument.Tables
With t
[stuff to do in the table]
End With
Next
End Sub
.... but I cannot get the macro to delete row 7. Now, since not all
tables have seven rows, I first need to ascertain this by using, I
presume, Selection.Information(wdMaximumNumberOfRows). However, I
can't think of how to adapt this command for use in this macro.
I tried:
t.Information(wdMaximumNumberOfRows)
but that doesn't work.
Can anyone give me any suggestions?
Thanks so much.
Steve Wylie
Kent, England