J
James Pannozzi
I have numbers such as the following
in some cells in a Word 2000 table
which are pt\ut there by VBA.
The numbers are in cells in column 1, in rows 5, 6 and 7
$40,000.00 for the first period
$75,000.12 for the next period
$100,000.19 at age 89
I would like to execute some VBA which would align
the numbers by the decimal point so that the above
would appear as
$40,000.00 for the first period
$75,000.12 for the next period
$100,000.19 at age 89
I tried the following VBScript (see below) (which applies to the entire
column)
and all it does is move numbers such as 3. in other cells of column 1
off to the right but has no effect on the dollar amounts mentioned.
How does one do it??
Thanks Jim
Sub DecimalTabStopInTableColumn()
Dim tbl 'As Word.Table
Dim col 'As Word.Column
Dim cel 'As Word.Cell
Set tbl = objWord.ActiveDocument.Tables(1)
Set col = tbl.Columns(1)
For Each cel In col.Cells
cel.Range.ParagraphFormat.TabStops.Add
40,wdAlignTabDecimal,wdTabLeaderSpaces
'Alternative:
' cel.Range.Paragraphs.Style = "TableColumnDecimalAlign"
Next
End Sub
in some cells in a Word 2000 table
which are pt\ut there by VBA.
The numbers are in cells in column 1, in rows 5, 6 and 7
$40,000.00 for the first period
$75,000.12 for the next period
$100,000.19 at age 89
I would like to execute some VBA which would align
the numbers by the decimal point so that the above
would appear as
$40,000.00 for the first period
$75,000.12 for the next period
$100,000.19 at age 89
I tried the following VBScript (see below) (which applies to the entire
column)
and all it does is move numbers such as 3. in other cells of column 1
off to the right but has no effect on the dollar amounts mentioned.
How does one do it??
Thanks Jim
Sub DecimalTabStopInTableColumn()
Dim tbl 'As Word.Table
Dim col 'As Word.Column
Dim cel 'As Word.Cell
Set tbl = objWord.ActiveDocument.Tables(1)
Set col = tbl.Columns(1)
For Each cel In col.Cells
cel.Range.ParagraphFormat.TabStops.Add
40,wdAlignTabDecimal,wdTabLeaderSpaces
'Alternative:
' cel.Range.Paragraphs.Style = "TableColumnDecimalAlign"
Next
End Sub