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 2006

Tip: Looking for answers? Try searching our database.

formatting currency

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rub - 10 Nov 2006 22:35 GMT
I can't get the variable curRento to format in currency.  Any ideas?

Private Sub Document_Open()

Dim strSite As String
Dim curRent As Currency
Dim intLen As Integer

ActiveDocument.Tables(2).Cell(1, 1).Range.Select

intLen = ActiveDocument.Tables(2).Rows.Count
Select Case intLen
Case 3
   curRent = Val(ActiveDocument.Tables(2).Cell(2, 3).Range.Text) +
Val(ActiveDocument.Tables _(2).Cell(3, 2).Range.Text)
Case 4
   curRent = Val(ActiveDocument.Tables(2).Cell(2, 3).Range.Text) +
Val(ActiveDocument.Tables _(2).Cell(3, 3).Range.Text) +
Val(ActiveDocument.Tables(2).Cell(4, 2).Range.Text)
Case 5
   curRent = Val(ActiveDocument.Tables(2).Cell(2, 3).Range.Text) +
Val(ActiveDocument.Tables _(2).Cell(3, 3).Range.Text) +
Val(ActiveDocument.Tables(2).Cell(4, 3).Range.Text) + Val
_(ActiveDocument.Tables(2).Cell(5, 2).Range.Text)
Case 6
   curRent = Val(ActiveDocument.Tables(2).Cell(2, 3).Range.Text) +
Val(ActiveDocument.Tables(2).Cell(3, 3).Range.Text) +
Val(ActiveDocument.Tables(2).Cell(4, 3).Range.Text) + Val
_(ActiveDocument.Tables(2).Cell(5, 3).Range.Text) +
Val(ActiveDocument.Tables(2).Cell(6, _ 2).Range.Text)
End Select

curRent = FormatCurrency(curRent, 2)
ActiveDocument.Tables(2).Cell(intLen, 2).Range.Text = curRento

ActiveDocument.Tables(1).Cell(1, 1).Range.Select
ActiveDocument.Tables(1).Cell(1, 2).Range.Text = curRento
End Sub
Doug Robbins - Word MVP - 11 Nov 2006 01:30 GMT
curRent = Format(curRent, "$#,###.00")

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

>I can't get the variable curRento to format in currency.  Any ideas?
>
[quoted text clipped - 34 lines]
> ActiveDocument.Tables(1).Cell(1, 2).Range.Text = curRento
> End Sub
rub - 11 Nov 2006 13:22 GMT
thanks for your help

> curRent = Format(curRent, "$#,###.00")
>
[quoted text clipped - 44 lines]
> > ActiveDocument.Tables(1).Cell(1, 2).Range.Text = curRento
> > End Sub
 
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.