Macro to set selected cell padding to table default

F

Fred Holmes

Word 2003 In a Table, using a macro:

I can customize the cell padding with the following code:

With Selection.Cells(1)
.TopPadding = InchesToPoints(0.05)
.BottomPadding = InchesToPoints(0.05)
.LeftPadding = InchesToPoints(0.05)
.RightPadding = InchesToPoints(0.05)
.WordWrap = True
.FitText = False
End With

which code was obtained by recording "keystrokes" (mouse clicks and
keystrokes).

If I then run a record-keystroke macro to remove the custom padding
from the cell I get only the last two lines of code (.WordWrap and
..FitText). The "TopPadding =", etc., statements are missing
altogether. But running this "remove" macro doesn't work. The
existing custom padding in the selected cell remains.

Is there a VBA statement that will remove the custom padding from the
selected cell?

Thanks,

Fred Holmes

I chose to post this under "Tables" rather than macros or VBA, and did
not cross-post. Hope I did it correctly.
 
C

Cindy M -WordMVP-

Hi Fred,
I chose to post this under "Tables" rather than macros or VBA, and did
not cross-post. Hope I did it correctly.
I'd probably have chosen a cross-post (so that the message appears in
both groups, but you only post once). Sometimes, you can get VBA help in
an end-user group; and sometimes an end-user group can give you a
solution the VBA folks aren't aware of :)

Anyway, can you describe the actions you took when recording the second
macro, where the CellPadding actions weren't recorded? Did you type in
values, or click a button to "reset" the cell padding, or...?

<<Word 2003 In a Table, using a macro:

I can customize the cell padding with the following code:

With Selection.Cells(1)
.TopPadding = InchesToPoints(0.05)
.BottomPadding = InchesToPoints(0.05)
.LeftPadding = InchesToPoints(0.05)
.RightPadding = InchesToPoints(0.05)
.WordWrap = True
.FitText = False
End With

which code was obtained by recording "keystrokes" (mouse clicks and
keystrokes).

If I then run a record-keystroke macro to remove the custom padding
from the cell I get only the last two lines of code (.WordWrap and
..FitText). The "TopPadding =", etc., statements are missing
altogether. But running this "remove" macro doesn't work. The
existing custom padding in the selected cell remains.>>

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

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