'功能模块:数字转英文(货币)大写
'PublicFunctionNumberToString(NumberAsDouble)AsString
'调用形式:debug.printNumberToString(1234.32)
'说明:最大支持12位数字,小数点后精确两位
'程序:杨鑫光(Volitation)
DimStrNO(19)AsString
DimUnit(8)AsString
DimStrTens(9)AsString
软件开发网
PublicFunctionNumberToString(NumberAsDouble)AsString
DimStrAsString,BeforePointAsString,AftERPointAsString,tmpStrAsString
DimPointAsInteger
DimnBitAsInteger
DimCurStringAsString
CallInit
'//开始处理
Str=CStr(Round(Number,2))
'Str=Number
IfInStr(1,Str,".")=0Then
BeforePoint=Str
AfterPoint=""
Else
BeforePoint=Left(Str,InStr(1,Str,".")-1)
AfterPoint=Right(Str,Len(Str)-InStr(1,Str,"."))
EndIf
IfLen(BeforePoint)>12Then
NumberToString="TooBig."
ExitFunction
EndIf
Str=""
DoWhileLen(BeforePoint)>0
nNUMLen=Len(BeforePoint)
IfnNumLenMod3=0Then
CurString=Left(BeforePoint,3)
BeforePoint=Right(BeforePoint,nNumLen-3)
Else
CurString=Left(BeforePoint,(nNumLenMod3))
BeforePoint=Right(BeforePoint,nNumLen-(nNumLenMod3))
EndIf
nBit=Len(BeforePoint)/3
tmpStr=DecodeHundred(CurString)
http://www.mscto.com