This is probably a problem with communications between two data types. I always try to avoid using a Variant data type because I've ran into this problem myself. Also make sure you're not trying to push a Variant onto a Long or Integer, regardless if it fits. Use:
LongvariableX = val(VariantVariable)
not: LongvariableX = VariantVariable
Variants usually work good the other way around on strings:
StringVariable = VariantVariable mainly because Variants
variables can "read" long, integers and allows you to place representations of these into a string, but you can't do it the other way around, and -get this- it does treat these differently when being ran from the exe versus the environment.
Also try specifying every variable you are going to use and don't use Variants for numeric values, unless you can help it. Long variable are actually more memory efficient and make your code run faster than integers.