Here's mine. The table and shifting should be right.

Code:

function vigenere($t,$k,optional $d)
dim $j,$r,$,$p,$o,$m,$y
for $j = 65 to 90
$ = chr($j)+$+chr($j+32)
next
$p = "0123456789"+$
$m = 62 - (ucase($t+$k)=$t+$k)*26
for $j = 1 to len($t)
do
$ = left($k,1)
$k = substr($k,2)+$
$ = instr($p,$)
until $
$y = substr($t,$j,1)
if instr(".!? ",$y)
$o = ($y=" ")*($o+1)
endif
$r = instr($p,$y)
$vigenere = $vigenere + iif($r,substr($p, (iif($d,$m-$,$)+$r+o-1) mod $m+1,1),$y)
next
endfunction


_________________________
Eric