小说网 找小说 无限小说 烟雨红尘 幻想小说 酷文学 深夜书屋

调用EXCEL 实现阿拉伯数字转中文

方法一:

Private Sub Command1_Click()
Dim xlapp As Object, n As Currency, temp As String
Set xlapp = CreateObject("Excel.Application")
Randomize
n = Int(Rnd * 10 ^ 15)
temp = n
temp = temp & vbCrLf & xlapp.Evaluate("NUMBERSTRING(" & n & ", 1)")
temp = temp & vbCrLf & xlapp.Evaluate("NUMBERSTRING(" & n & ", 2)")
temp = temp & vbCrLf & xlapp.Evaluate("NUMBERSTRING(" & n & ", 3)")
Set xlapp = Nothing
MsgBox temp
End Sub
 

 

方法二:

Private Sub Command1_Click()
Dim xlapp As Object, n As Currency, temp As String
Set xlapp = CreateObject("Excel.Application")
Randomize
n = Int(Rnd * 10 ^ 12)
temp = n
temp = temp & vbCrLf & xlapp.Evaluate("text(" & n & ",""[dbnum1]"")")
temp = temp & vbCrLf & xlapp.Evaluate("text(" & n & ",""[dbnum2]"")")
temp = temp & vbCrLf & xlapp.Evaluate("text(" & n & ",""0[dbnum1]"")")
Set xlapp = Nothing
MsgBox temp
End Sub

posted on 2007-06-30 16:40  王峰炬  阅读(196)  评论(0编辑  收藏  举报

导航