'MS Word - Table pasting with incorrect text wrapping property and can't change setting after pasting

I have some code that replicates table header rows onto a bunch of other tables. I was mainly using the selection.copy and selection.paste features with the source range set to entire rows.

When I do this though, the copied rows not only don't merge, but for some reason the text wrapping settings gets changed to 'Around'. I checked both the source and destination table and their text wrapping setting is set to 'None'. I tried Selection.pasteandformat and went through all the table-specific and generic WdRecoveryType enumerations, and none of them seemed to make a difference.

I also have code in the beginning that sets the text wrapping for all tables to 'None' to ensure none of the source tables being copied have their text wrapping settings set to 'Around', but they're still being copied with the 'Around' setting.

For Each aTable In ActiveDocument.Tables
    aTable.Rows.WrapAroundText = False
Next aTable

So I'm thinking fine, since I can't get it to paste with no text wrapping, then at the least I will attempt to change it manually after it's pasted. But when I attempt to change the text wrapping of the pasted rows from 'Around' to 'None', 'None' is grayed out and unable to be selected. And with the text wrapping unable to change, I can't get the two tables to combine correctly.

enter image description here

Just for some additional clarification the source and target table have the same number of max columns (27), but some of the rows from the source table being pasted have cells merged horizontally (i.e. one row only has one column that spans the length of the entire table). The columns in the target table are consistent in that every row has 27 columns, each with the same width.

I also did a test and tried splitting the rows in the source table with the lesser number of columns so that it has the same number of columns as the target table and it didn't seem to make a difference. The results are below where as you can see the two tables are not merged which is apparent by the table selection button on the left side after the third row. And checking the table properties the copied rows (which make up the first three columns) has text wrapping set to 'Around'.

enter image description here

Any thoughts or help on this would be appreciated. Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source