formatting currency

R

rub

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
 
D

Doug Robbins - Word MVP

curRent = Format(curRent, "$#,###.00")

--
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
 
R

rub

thanks for your help



curRent = Format(curRent, "$#,###.00")

--
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
 

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