Working in Word 2003. If you format a table using the Word menus/dialogs, you
have the option of not allowing spacing between cells. (Table | Table
Properties. On the Table tab, Options then remove checkmark in front of
"Allow spacing between cells.")

When I try to accomplish the same thing via VBA, it doesn't really remove
the spacing, it sets the spacing to 0. Spacing at 0 doesn't look quite the
same as "Allow spacing = False."

Both of the following give the same results. 0 spacing, but "Allow spacing
between cells" is still true (checked) in the Options dialogbox -- and the
table looks a wee bit funny.

Selection.Tables(1).Spacing = 0
And
Selection.Tables(1).Spacing = False

I can't find anything re. how to set between-cell spacing other than the
Spacing property.
Is there a way I can use VBA to essentially say "Allow spacing between cells
= False"?

RE: no spacing between cells in table by lf

lf
Sat Feb 03 11:13:00 CST 2007

See this article - it suggests two workarounds to the problem:
http://word.mvps.org/faqs/macrosvba/TableSpacingOff.htm

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"Lisa" wrote:

> Working in Word 2003. If you format a table using the Word menus/dialogs, you
> have the option of not allowing spacing between cells. (Table | Table
> Properties. On the Table tab, Options then remove checkmark in front of
> "Allow spacing between cells.")
>
> When I try to accomplish the same thing via VBA, it doesn't really remove
> the spacing, it sets the spacing to 0. Spacing at 0 doesn't look quite the
> same as "Allow spacing = False."
>
> Both of the following give the same results. 0 spacing, but "Allow spacing
> between cells" is still true (checked) in the Options dialogbox -- and the
> table looks a wee bit funny.
>
> Selection.Tables(1).Spacing = 0
> And
> Selection.Tables(1).Spacing = False
>
> I can't find anything re. how to set between-cell spacing other than the
> Spacing property.
> Is there a way I can use VBA to essentially say "Allow spacing between cells
> = False"?

RE: no spacing between cells in table by Lisa

Lisa
Sat Feb 03 13:45:00 CST 2007

Lovely. Thanks much!

"Lene Fredborg" wrote:

> See this article - it suggests two workarounds to the problem:
> http://word.mvps.org/faqs/macrosvba/TableSpacingOff.htm
>
> --
> Regards
> Lene Fredborg
> DocTools - Denmark
> www.thedoctools.com
> Document automation - add-ins, macros and templates for Microsoft Word
>
>
> "Lisa" wrote:
>
> > Working in Word 2003. If you format a table using the Word menus/dialogs, you
> > have the option of not allowing spacing between cells. (Table | Table
> > Properties. On the Table tab, Options then remove checkmark in front of
> > "Allow spacing between cells.")
> >
> > When I try to accomplish the same thing via VBA, it doesn't really remove
> > the spacing, it sets the spacing to 0. Spacing at 0 doesn't look quite the
> > same as "Allow spacing = False."
> >
> > Both of the following give the same results. 0 spacing, but "Allow spacing
> > between cells" is still true (checked) in the Options dialogbox -- and the
> > table looks a wee bit funny.
> >
> > Selection.Tables(1).Spacing = 0
> > And
> > Selection.Tables(1).Spacing = False
> >
> > I can't find anything re. how to set between-cell spacing other than the
> > Spacing property.
> > Is there a way I can use VBA to essentially say "Allow spacing between cells
> > = False"?

RE: no spacing between cells in table by Lisa

Lisa
Sun Feb 04 09:21:00 CST 2007

Thanks again for the tip, Lene.
This is just an update for potential benefit of other forum participants...

The article you directed me to had two potential work arounds... One set
spacing to a negative ("-1") which gave the right appearance but left "Allow
spacing between cells" checked in the Table Options dialog box. The other
displayed the dialog and used the Send key to change the setting.

I couldn't make the second approach work for me at all, but it certainly
pointed me in the right direction. Using Word 2003, the following unchecks
the "Allow spacing between cells" checkbox and removes between cell spacing
in the selected table.

With Dialogs(wdDialogTableTableOptions)
.AllowSpacing = 0
.Execute
End With