View Single Post
  #1   Report Post  
Posted to microsoft.public.word.tables
Skids Skids is offline
external usenet poster
 
Posts: 1
Default How to merge 2 tables and use 1st tables format?

We have a small VBA routine which performs automatic mail merging for some
Document Production routines we use in-house and I have stumbled across an
issue I can't resolve easily. The application is passed a Word Template name
and a data file and performs the mail merge, which works perfectly well. The
problem starts with tables. The VBA was written by a previous developer and
they took the approach of reading the number of rows required from the data
file, inserting them one by one, then going back and filling in the contents
of each cell until the data file was exhausted. This generally works fine
with not "too much" of a performance issue. However, since I've taken this
onboard we now have a customer who produces statements that require a table
that spans between 30 and 50 pages! The old approach takes upwards of 10
minutes per document and that's dire! Therefore I've taken a new approach of
reading in the whole data file (well the table data section anyway) directly
into the document, doing a Convert Text to Table, and then applying the
format of my master table section (basically consists of a header row and 1
blank row for formatting purposes) by going through each cell and copying the
format to the new tables relevant column. This works and cuts the time down
to about 1 minute which is significantly faster than the previous method.
However, I am hoping that there is a faster method still and wonder if anyone
has any ideas? Any help would be greatly appreciated as I know that tables in
VBA is pretty slow and tedious anyway! Many thanks in advance.