As some of you correctly pointed out the LoadType() function does not work in RB version 2011+. It seems from 2011 on, the items list starts from 1 instead of 0. So change the line
for a = 0 to all.Count - 1
for a = 1 to all.Count
Thanks to everyone for bringing this to my attention.