Results 1 to 8 of 8
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    477
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Merging adjacent tables (Word 2003)

    I used to be able to make two tables in to one by just removing the paragraphs between them in Word 2000. Now in Word 2003, that does not seem to work. Does anyone have code for how to make two adjacent tables (one immediately following another) merge into a single table?

    Thanks!!
    Troy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Merging adjacent tables (Word 2003)

    Does the following work for you? It should merge the second table with the first one. Change the table number in Tables(2) to apply it to other tables.

    Dim n As Long
    n = ActiveDocument.Tables(2).Range.Start
    ActiveDocument.Range(n - 1, n).Delete

  3. #3
    4 Star Lounger
    Join Date
    Feb 2004
    Location
    Saint Charles, Missouri, USA
    Posts
    565
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Merging adjacent tables (Word 2003)

    Would this not be better in WORD Category ?

    Having said this, I need to keep an eye on this post - I thought you still could merge two adjacent tables by getting rid of paragraph marks (View Normal view used).

    iwill have to check which version of MSO Word I'm using on the main work PC.
    Scott

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Merging adjacent tables (Word 2003)

    I have seen this happen when one or both of the tables are "floating", but not if they are normal straightforward tables. This can be caused accidentally by dragging the table using the little symbol in the corner (two crossed double headed arrows in a small square).

    If this has happened unintentionally, then you can fix it by Table > Properties > and setting Text Wrapping to None

    StuartR

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Merging adjacent tables (Word 2003)

    I have moved this entire thread from the VBA forum to the Word forum, as it is about Word Tables and doesn't involve VBA.

    StuartR

  6. #6
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    477
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Merging adjacent tables (Word 2003)

    As usual, I haven't included enough information. I am working with an existing macro that helps clean up output from RoboHelp when it generates a Word document from online help.

    Due to the way you have to apply conditions to entire tables instead of individual table rows, I have many tables that appear in the Word output as individual rows or groups of rows separated by a paragraph.

    In the past, the macro looked for two tables separated by a single empty paragraph and removed that paragraph. This resulted in the tables being merged into a single table. If you clicked any where in the table and chose to select the entire table, the entire table (what had been two tables) would have been selected. Word now saw this as a single table. Now in Word 2003, that does not appear to be the case.

    I need to find a way to merge two adjacent tables so that Word sees it as a single table. I also need to be able to do this through VBA.

    I tried the code Hans posted, but for whatever reason, it does not seem to do anything.

    Please help.

    Thanks!!
    Troy

  7. #7
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Merging adjacent tables (Word 2003)

    Did you look at the table properties to see if they had been created as floating tables?
    You could try using the following line for each table.

    <code>tbl.Rows.WrapAroundText = False</code>

    StuartR

  8. #8
    4 Star Lounger
    Join Date
    Feb 2004
    Location
    Saint Charles, Missouri, USA
    Posts
    565
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Merging adjacent tables (Word 2003)

    SturtR

    For what it is worth, tried your code and worked fro me.

    Also did it manually and was able to merge the tables - Had "Floating" tables.

    Troy - Thanks for the post - Solved a problem I didn't know we had.
    Scott

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •