function vbGetGBCode(str) dim i, length, s length = len(str) for i = 1 to length hexCode = hex(asc(str.charAt(i - 1))) if (len(hexCode) mod 2) = 0 then s = s & hexCode else s = s & "0" & hexCode end if next vbGetGBCode = s end function