Quote:
Originally Posted by CodingGuruInTraining
I'm experiencing some minor issues when I run this code:
- The tables as a whole are left aligned, then some are halfway off the left side. How could you make them centered in the page?
|
When I ran it, the macro centred the tables on the page.
Quote:
- When I try to add code to repeat the first row, I get an error again about merged cells. Is it a matter of where it is placed in the code or how? I've been trying this code:
Code:
Tbl.Rows(1).HeadingFormat = True
|
You can't do that in a table with vertically-merged cells. The simplest way around that is to select a cell on that row and use the selection to apply the heading format.
Quote:
- The table gets messed up when it comes across unmerged cells in column 1 (for obvious reasons), which can happen often with these documents. Could there be a check added to see if the cells are merged first and to merge them if they are not? I am thinking something like this (I know this isn't correct, but I'm still learning):
Code:
If Case 1: .Cells.Merge = False Then
.Cells.Merge
Else Next
|
What you need to do here is to test whether the 5th cell in the group is in column 1; it shouldn't be. If it is, use the selection process again to merge the column1 cells
Quote:
- I'd like the horizontally merged cells to be a set height, but still be able to expand if too much content is added (AutoFit I think). My first attempt was with the following code, but it didn't seem to do anything.
Code:
If .Cells().Width = InchesToPoints(6.21) Then
.Cells.Height = InchesToPoints(0.8)
End If
|
The way to do that is via the SetHeight method.
I've incorporated the above, plus comments into the code in my previous post.