VB Code:
  1. ID = ConvertToInteger("&H" & Right(Filename, 3)

And then In ConvertToInteger function use CInt.