|
楼主 |
发表于 2004-3-22 15:24
|
显示全部楼层
能否利用以下代码,修改一下?
Sub 人民币大写() Dim seltxt As String Dim zx As Double, xx As Double Dim selcase As String seltxt = Selection.Text zx = Int(Val(seltxt)) If zx < 0 Then zx = Abs(Int(Val(seltxt))) selcase = "红书" Else selcase = "" End If xx = (Round(Val(seltxt), 2) - zx) * 100 Selection.MoveRight Unit:=wdCharacter, Count:=1 If zx <> 0 Then gxs = "= " + Str(zx) + " \* CHINESENUM2" Set ym = Selection.Fields.Add(Range:=Selection.Range, Text:=gxs) selcase = selcase + ym.Result + "元" Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Selection.TypeBackspace Selection.Delete End If gxs = "= " + Str(xx) + " \* CHINESENUM2" Set ym = Selection.Fields.Add(Range:=Selection.Range, Text:=gxs) xxcase = ym.Result Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Selection.TypeBackspace Selection.Delete
Select Case xx Case 0 selcase = selcase + "整" Case 1 To 9 selcase = selcase + "零" + xxcase + "分" Case 10 To 99 If (xx Mod 10) = 0 Then selcase = selcase + Left(xxcase, 1) + "角整" Else selcase = selcase + Left(xxcase, 1) + "角" + Right(xxcase, 1) + "分" End If End Select Selection.Text = selcase End Sub
让它变成:把数字自动加上千分号?多谢!等! |
|