function Gimatria(byval n)
dim p
if n mod 1000 = 0 then
Gimatria = Gimatria ( n \ 1000 ) & "אלפים"
exit function
elseif n > 1000 then
Gimatria = Gimatria(n\1000) & Gimatria ( n mod 1000 )
exit function
end if
p = ""while n >= 400
p = p & "ת"
n = n - 400
wend
if n >= 100 then
' p = p & chr(246 + n\100)
p = p & mid( "קרשת", n\100, 1 )
n = n mod 100
end if
if n >= 10 then
if n = 15 or n = 16 then n = n - 9
if n\10 > 0 then
p = p & mid( "יכלמנסעפצ", n\10, 1 )
else
p = p & "ט"
end if
n = n mod 10
end if
' if n > 0 then p = p & chr( 223 + n )
if n > 0 then p = p & mid( "אבגדהוזחט", n, 1 )
if len(p) <= 1 then
p = p & "'"
else
p = left( p, len(p)-1) & """" & right(p,1)
end if
Gimatria = p
end function