How to determine Table Indent


S

survivor

I used to use Table.Rows.LeftIndent property to determine a table's indent
value. If this is value was set to wdUndefined then usually
Table.Rows(0).LeftIndent is the most appropriate since some documents tend
to indent all other rows slightly to enhance the appearance. I have found
that some tables have vertically merged cells so individual rows cannot be
accessed. However, Word reports the correct value from the Table Properties
menu. Is there a way to obtain the indent value in VBA under these
conditions? (Table.Rows.Leftindent returns wdUndefined and the table has
vertically merged cells)
 
Ad

Advertisements

H

Helmut Weber

Hi Survivor,

just a workaround, if there is no better solution,
split the table temporarily, like:

Sub testx23()

With Selection.Tables(1).Range
.Cells(.Cells.Count).Select
End With
Selection.SplitTable
Selection.MoveDown
MsgBox Selection.Tables(1).Rows(1).LeftIndent
ActiveDocument.Undo 1
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
T

Tony Jollans

I *think* this should always work:

<table_ref>.Range.Cells(1).Range.Rows.LeftIndent
 
S

survivor

Less than ideal but it works. A clever trick but, as you mentioned, good as
a workaround. Thank you
 
Ad

Advertisements

Joined
Mar 2, 2016
Messages
1
Reaction score
0
The following also works for reading the .LeftIndent property of tables with (vertically) merged cells:

<table ref>.Cell(1, 1).Range.Rows.LeftIndent

But to set the LeftIndent for the whole table, you have to use:

<table_ref>.Range.Rows.LeftIndent = value_in_points

(use of <table ref>.Cell(1, 1).Range.Rows.LeftIndent = value_in_points sets a left indent for row 1)

Perplexing!!

Richard (from Piracicaba, SP, Brazil)
 
Ad

Advertisements


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