View Single Post
 
Old 09-19-2015, 06:43 PM
CodingGuruInTraining CodingGuruInTraining is offline Windows Vista Office 2010 32bit
Novice
 
Join Date: Sep 2015
Posts: 13
CodingGuruInTraining is on a distinguished road
Default Combining 2 tables into 1 and use Table2's column widths (hoping for workaround dealing merged cells

Hello,

I am trying to create a Word macro that will adjust every table in a document to have specific column widths. These documents I work with can vary anywhere from 15 pages to 1000 pages with varying table lengths, but always with 4 columns. The problem is there are merged cells (both vertical and horizontal) in each table and they are needed for this project, so they have to stay. I have been searching for days, but I have not been able to find a code that truly works around this issue.

Since it looks like VBA can't modify a table with merged cells, I thought it might be possible to make a new table the way I want it formatted and then combine that with a table in the document. Is it possible to create a macro that can perform the following actions and if so, how would it look in VBA:

1) Find table (Table1)
2) Add new 1x4 table (Table2) above (or below if it matters) Table1 with desired column widths
' this would basically be a copy header row found on every table in document
3) Combine (snap together) Table1 and Table2, using Table2's column widths
' if not possible, then perhaps Table2's "table width" will work
4) Delete 2nd row (formerly 1st row) in each table
5) Next table

Any advice would be appreciated!
Reply With Quote