Numberic formatting in table cells

K

kdw

How do I apply currency formatting to an entire column or individual cells in
a table through VBA?

I have used the method in Ken Getz's book on converting a recordset in
Access to a Word table using

..InsertAfter varData
Set objTable = .convertToTable()

Everything works great except that the values in one of the columns should
be currency. I can not find the proper method(s) to format the column.

I am using this through automation from Access.

Thank you!
 
D

Doug Robbins - Word MVP

Dim i As Long, curange As Range
With ActiveDocument.Tables(1)
For i = 1 To .Rows.Count
Set curange = .Cell(i, 1).Range
curange.Text = Format(Val(curange.Text), "$#,###.00")
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
K

kdw

With the exception of having to specify curange as Word.Range since I am
calling this in Acess, this works perfectly! Just what I am looking for.
Thank you Doug!
 

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