Function BCD(x As integer) As integer Local a$ Local integer n,q a$=Str$(x) For n=1 To Len(a$) q=(q<<4) Or (Val(Mid$(a$,n,1))) Next BCD=q End Function