Results 1 to 2 of 2
2004-07-12, 18:03 #1
- Join Date
- May 2003
- Los Angeles, California, USA
- Thanked 2 Times in 2 Posts
Macro to set default cell margins in table style (Word 2002 SP-2)
There are 2 different Table Properties settings relating to cell margins. Go to the Table tab and hit the Options button and you can set the "default cell margins" for the table. Go to the Cell tab and hit the Options button and you can set the margins for the current cell (or multiple selected cells), or you can check a box that says "Same as the whole table."
I'd like the default top & bottom margins for the Table Grid style (in my Normal template) to be 0.02", and I'm working on a set of macros that take a newly-generated Word default Normal template and turn it into my own Normal template. One of the macros tweaks the Table Grid style in several ways, and includes these lines:
Dim S As Word.Style
Set S = ActiveDocument.Styles("Table Grid")
.TopPadding = InchesToPoints(0.02)
.BottomPadding = InchesToPoints(0.02)
Set S = Nothing
The style.Table.padding references correspond to the code that gets generated when I record a macro that adjusts the default cell margins for a table. But the result of running my macro is that the cell margin settings under the Cell tab get changed, while the default cell margins (under the Table tab) remain set at 0".
Strangely, I haven't been able to discover any substantive difference that this makes. Most significantly, if I insert a new row into a table based on this style, the cells in the new row reflect the 0.02" padding (as if that was the default for the table). Still, it's confusing (not to mention misleading) to go to the Options under the Table tab and see 0" in the default cell margins boxes.
Anyone know what's going on, and how I can set the "default cell margins" for the Table Grid style using VBA?
2004-07-12, 21:17 #2
- Join Date
- Feb 2001
- Silicon Valley, USA
- Thanked 94 Times in 90 Posts
Re: Macro to set default cell margins in table style (Word 2002 SP-2)
I can replicate the issue. I also run Word 2002 SP-2. I should install SP3 any day now; maybe that will help.