Allow Spacing Between Cells cannot be changed in a Macro

B

Baconbutty

Hi

I have being trying to create a macro in Word 2002 which makes certain
formatting changes to a selected Table.

One of those changes I had hoped to make was to set "Allow Spacing
Between Cells" to "no".

Now this is possible through the "Table Properties" ---> "Options"
dialogue box, where there is a check box (as well as an input field for
the spacing if allowed).

But there does not seem to be any way to do this through a Macro.

Setting "myTable.Spacing=0", DOES NOT uncheck the above check box.

In fact, what it does is set Table.Spacing to 0.01, which is almost,
but not enough. 0.01 is enough to make a tiny difference to the
display.

There does not appear to be any other Property or Method of the Table
object to achieve this.

Any ideas?

Regards

Julian Turner
 
B

Baconbutty

Baconbutty wrote:

[snip]
Hi

I have being trying to create a macro in Word 2002 which makes certain
formatting changes to a selected Table.

One of those changes I had hoped to make was to set "Allow Spacing
Between Cells" to "no".

Now this is possible through the "Table Properties" ---> "Options"
dialogue box, where there is a check box (as well as an input field for
the spacing if allowed).

But there does not seem to be any way to do this through a Macro.
[/snip]

A bit more research, and found this on MVP web site:-

<quote>
"There seems to be no supported way in VBA to turn the "Allow spacing
between cells" Table property off. You can set the Spacing property
to 0 but the resulting table looks very different from how it looks if
you de-select the "Allow spacing between cells" checkbox manually
using the Table + Properties dialog.

Workaround 1
Selection.Tables(1).Spacing = -1

makes the table look right.

It's a kludge, because if you then look in the dialog you'll see that
"Allow spacing" is still ticked - but it's much better than no
workaround at all!

Workaround 2
SendKeys "%s{Enter}"
Dialogs(1080).Show

also works. This second workaround has the advantage that it does
de-select the "Allow spacing" checkbox in the dialog - but
besides the inherent disadvantage in using SendKeys, the user will see
the dialog momentarily appear and disappear."
</quote>

That answers that then.

Regards

Julian Turner
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top