By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,401 Members | 803 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,401 IT Pros & Developers. It's quick & easy.

strange "overload" error at only 32999

P: 88
hi all,

i am trying to convert the string "32999" to a number, in order to compare it to other numbers and tell which one is the largest one, or if they're equal.

i keep getting an overflow error. this is for a macro organizing numbered folders, so i started out with lower numbers using
Expand|Select|Wrap|Line Numbers
  1. CInt(myNumberString)
which worked fine up to this point.
the odd thing is that i get overload using CLng and CDbl as well, even though i understand the limits for long and double numbers should be much higher. i have debugged and verified that the string being converted is really "32999".

what should i do to solve this?

(i'm writing vba for outlook 2003, running on win2k)
Apr 25 '08 #1
Share this Question
Share on Google+
2 Replies


P: 88
i found the problem myself:

32999 is a number too large to store in an integer variable - but even though i changed the explicit conversion to double, the variable was still declared as an integer. therefore, an implicit conversion to integer took place, which caused the overflow.
Apr 25 '08 #2

jamesd0142
100+
P: 469
Try using long im not sure what the max value of this is but its certainly bigger than standard integer.
Apr 25 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.