Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a change from string$ to integre

Status
Not open for further replies.

musalk

Programmer
Oct 30, 2001
33
DK
How to make a change from string$ to integre

eg.

abc$ = "123"

'i want that to be a intergre like

abc = 123

Please give an example.
 
Val(s) returns s As an integer but is prone to problems with "big" numbers.

There are better functions like cDbl(s) that return a double for s.

Wil Mead
wmead@optonline.net

 
Code:
Dim blnErr as Boolean
Dim intABC as integer
blnErr = IsNumeric(strABC)
if blnErr = false
    On error resume Next
        intAbc = Cint(strAbc) ' err if int < 32768 or > 32767
        blnErr = (Err.Number <> 0)
    On error goto 0
End if
if blnErr then
    MgBox &quot;oops&quot; 
End if
Compare Code (Text)
Generate Sort in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top