Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2005

Tip: Looking for answers? Try searching our database.

Numberic formatting in table cells

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kdw - 30 Nov 2005 18:19 GMT
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!
Doug Robbins - Word MVP - 30 Nov 2005 21:31 GMT
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

Signature

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

> How do I apply currency formatting to an entire column or individual cells
> in
[quoted text clipped - 12 lines]
>
> Thank you!
kdw - 30 Nov 2005 22:18 GMT
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!

> Dim i As Long, curange As Range
> With ActiveDocument.Tables(1)
[quoted text clipped - 20 lines]
> >
> > Thank you!

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.