以下程序是我在这里搜到的,很好用,但是还有一点问题: Dim Numeric As Currency, IntPart As Long, DecimalPart As Byte, MyField As Field, Lable As String Dim Jiao As Byte, Fen As Byte, Oddment As String, Odd As String, MyChinese As String Const ZWDX As String = "壹贰叁肆伍陆柒捌玖零" On Error Resume Next With Selection Numeric = sbzj30 'sbzj30是我要转换的金额 IntPart = Int(VBA.Abs(Numeric)) Odd = VBA.IIf(IntPart = 0, "", "圆") DecimalPart = (VBA.Abs(Numeric) - IntPart) * 100 Select Case DecimalPart Case Is = 0 Oddment = VBA.IIf(Odd = "", "", Odd & "整") Case Is < 10 Oddment = VBA.IIf(Odd <> "", "圆零" & VBA.Mid(ZWDX, DecimalPart, 1) & "分", _ VBA.Mid(ZWDX, DecimalPart, 1) & "分") Case 10, 20, 30, 40, 50, 60, 70, 80, 90 Oddment = "圆" & VBA.Mid(ZWDX, DecimalPart / 10, 1) & "角整" Case Else Jiao = VBA.Left(CStr(DecimalPart), 1) Fen = VBA.Right(CStr(DecimalPart), 1) Oddment = Odd & VBA.Mid(ZWDX, Jiao, 1) & "角" Oddment = Oddment & VBA.Mid(ZWDX, Fen, 1) & "分" End Select Set MyField = .Fields.Add(Range:=.Range, Text:="= " & IntPart & " \*CHINESENUM2") '该句的作用是把金额转换成大写,但是他同时在光标处插入了转换后的大写金额,这不是我所要的,有什么办法只让他转换而不插入。 MyChinese = VBA.IIf(MyField.Result <> "零", MyField.Result, "") MyField.Delete '虽然我用这句话把插入的大写金额删掉了,但是因为有了修改,所以关闭该word文档的时候就会提示是否保存修改 SSS30 = MyChinese & Oddment '其实我想要的只是这个SSS30 End With 还有一个问题是:我用 Set rngDoc = ActiveDocument.Range(Start:=263, End:=263) rngDoc.InsertBefore txtHTMFDW.Text 插入了控件txtHTMFDW的内容,但是不知道怎么设置所插入文本的字体,我想把他设为宋体不管是中文还是英文,不进行设置的话默认中文是宋体,英文好象是Times New Roman 小弟在这里先谢了! |