View Single Post
 
Old 06-08-2011, 10:17 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi flds,
I've tested the code. The error occurs when the source document has nothing before the first table. Please note that I only made the minimum changes necessary to integrate the code with what you asked for. Reworking the code to handle these conditions correctly will take a small amount of effort - but not today.

On reviewing the code I also found that (aside from the fact that it moves the tables to a new Word document instead of to an Excel workbook) a number of variables weren't defined and the code copies the paragraph following the table to the new document as well. Is that what you wanted? As for moving Word tables to Excel, whilst that's not all that difficult to do in principle, retaining the formatting gets complicated, especially if the Word table has merged cells.

As for the 'Appendix' Section you referred to, do all documents have one? Do the appendices only ever span one Section? Whatever the case, it would probably make sense to process the appendices before deleting the Section breaks.

I've also updated the 'Main' sub to handle documents that may have 0 and >1 TablesOfContents. Finally, contrary to what I had expected to happen, the code isn't deleting the tables in the source document. It will do so if you change:
SrcDocTableRange.Delete
to:
SrcDocTable.Delete
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote