Function ConvertRMB (ls ascurrency) asstring dim dx_sz asstring dim dx_dw asstring dim str_int asstring dim str_dec asstring dim dx_str asstring dim fu asstring dim a asstring dim b asstring dim c asstring dim d asstring dim b2 asstring dim num_int as number dim num_dec ascurrency dim len_int as number dim i as number dim a_int as number dim pp as number dx_sz="零壹贰叁肆伍陆柒捌玖" dx_dw="万仟佰拾亿仟佰拾万仟佰拾元" if ls<0then ls=abs(ls) fu="负" else fu="" endif dx_str=CStr (ls) dx_str=Replace (dx_str,"¥","") dx_str=replace(dx_str,",","") if (ls>0) and (ls<1) then dx_str="0"+dx_str pp=InStr (dx_str,".") if pp>0then str_int=mid(dx_str,1,instr(dx_str,".")-1) else str_int=dx_str endif num_int=ToNumber (str_int) if (ls>0) and (ls<1) then num_dec = ls*100 else num_dec=(ls-num_int)*100 endif str_dec=totext(num_dec) str_dec=replace(str_dec,"¥","") len_int=len(str_int) dx_str="" for i=1to len_int a=mid(str_int,i,1) a_int=tonumber(a) b=mid(dx_sz,(a_int+1),1) c=mid(dx_dw,(13-len_int+i),1) if dx_str<>""then d=mid(dx_str,len(dx_str)-1,1) else d="" endif if(b="零") and ((d="零") or (b=b2) or (c="元") or (c="万") or (c="亿")) then b="" if(a="0") and (c<>"元") and (c<>"万") and (c<>"亿") then c="" if((c="元") or (c="万") or (c="亿")) and (d="零") and (a="0") then dx_str=mid(dx_str,1,len(dx_str)-2) d=mid(dx_str,len(dx_str)-1,2) if((c="元") and (d="万"))or((c="万") and (d="亿")) then c="" endif dx_str=dx_str+b+c b2=b next i '处理金额小于1的情况 iflen(dx_str)<2then dx_str="" if(num_dec<10)and(ls>0) then a_int=tonumber(str_dec) b=mid(dx_sz,(a_int+1),1) if num_dec=0then dx_str=dx_str+"整" if num_dec>0then dx_str=dx_str+"零"+b+"分" endif if num_dec>=10then a_int=tonumber(mid(str_dec,1,1)) a=mid(dx_sz,(a_int+1),1) a_int=tonumber(mid(str_dec,2,1)) b=mid(dx_sz,(a_int+1),1) if a<>"零"then a=a+"角" if b<>"零"then b=b+"分"else b="" dx_str=dx_str+a+b endif if ls=0then dx_str="零元整" dx_str=fu+dx_str dx_str=replace(dx_str,"零亿","亿") dx_str=replace(dx_str,"零万","万") dx_str=replace(dx_str,"零千","千") dx_str=replace(dx_str,"零元","元") ConvertRMB =dx_str End Function