Enhancement of VBs Val function

Category:
Dates and Math
Type:
Snippets
Difficulty:
Beginning
Author:
Psycho

Version Compatibility:

More information:
This function, like VB's Val function, converts string values to long. It differs from VB's Val funciton in that it returns a default value (the function's second parameter) if it fails, whereas the VB version returns either 0, or a number for invalid input where the string begins with a number(e.g. ,Val(132wsdfas3423) returns 132).

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: