![]() |
|
#3
|
|||
|
|||
|
Hi Paul,
This worked except for the first new row did not size with the table. I found a thread where you suggested to remove the table and place in Excel, unmerge the cells there and then put back into Word. This might work well for my needs as I don't think table with vertically merged cells will be a large number. So, my thought, do as I mentioned above, but run my original code but add a skip when vertically merged cells are identified. As those tables are identified, I can write down the table number and deal with them one by one. I found this, but is this the best to skip? I only need to display and then skip if vertical merged cells are identified, but I don't need the message that gives the error description. Code:
Sub tableformat()
Dim i As Long
Dim oRow As Row
Dim oCol As Column
On Error GoTo ErrHandler
For i = 1 To Selection.Tables.Count
For Each oRow In Selection.Tables(i).Rows
Next oRow
NextStep:
For Each oCol In Selection.Tables(i).Columns
Next oCol
NextTable:
Next i
Exit Sub
ErrHandler:
Select Case Err
Case 5991
MsgBox "Table #" & i & " has vertically merged cells"
Resume NextStep
Case Else
MsgBox "Error " & Err.Number & ": " & _
Err.Description & " in table #" & i
Resume NextTable
End Select
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Want to copy & paste a table underneath itself x no. of time, table found through style heading name
|
fly545 | Word VBA | 11 | 01-16-2020 05:53 PM |
| Can I create a page number from a non-Heading style? | techwriter3k | Word | 9 | 09-25-2019 06:58 AM |
| Deleting Blank Space between table heading and table rows | Pete Jones | Word Tables | 5 | 01-22-2018 04:11 PM |
Heading row disappears from table styles when pasted table is selected
|
andrewballem | Word Tables | 2 | 11-12-2013 05:18 AM |
Create and save custom heading style
|
ubns | Word | 3 | 08-01-2012 09:42 PM |