Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2005

Tip: Looking for answers? Try searching our database.

word VBA - Merging two tables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sebastian - 26 Apr 2005 07:15 GMT
Hello VBA checkers,

i wrote a word2000 macro, where i have to put two tables together. The
problem is that the second table can have one more column than the
first. I just want to glue both tables together to one.
The following code does this job, but it is very slow. I'd like to
connect two tables with over 1000 rows:

'add one row, on this row the new ones are added
firstTable.Rows.Add
   
For Each row In secondTable.Rows
       
   firstTable.Rows(firstTable.Rows.Count).Range.FormattedText =
row.Range.FormattedText
       
Next

'remove last row, its empty
firstTable.Rows(firstTable.Rows.Count).Delete

Did someone knows a better, and faster way to do this job?

Thanks, in advance

Sebastian
Helmut Weber - 26 Apr 2005 13:28 GMT
Hi Sebastian,

I wonder,

as here and now, 2 tables, one with 5 columns
and another one with 4 columns,
seperated e.g. by an empty paragraph,
will merge without any problem,
just by removing what seperates them.

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.