Function Basic Extensions Class

FindError

Returns a String containing the number and message of all errors where some part of the error message string matches vPattern.

Signature (Visual Basic / VBA)

Public Function FindError( _
    ByVal vPattern As Variant _
    ) As Variant

Code Example

    ? FindError("bad")
    49: Bad DLL calling convention
    52: Bad file name or number
    54: Bad file mode
    59: Bad record length
    63: Bad record number
    ? FindError("dll")
    47: Too many DLL application clients
    48: Error in loading DLL
    49: Bad DLL calling convention
    453: Specified DLL function not found

Parameters

Parameter Description
vPattern String containing the phrase or Visual Basic "Like" pattern that will be searched for within all Visual Basic error messages. Function returns Null if vPattern is Null or cannot be fixed up to a String.

Notes & Version History

Summary This function returns each of the Visual Basic errors whose messages contain some string (like "bad" or "overflow") or matches some pattern (like "bad*" or "*opera[nt]*"). If vPattern is a phrase such as "bad" which does not contain any of the special characters recognized by the Visual Basic "Like" operator, then this function will search for that string anywhere within the error messages--it is the same as putting asterisks around it as in "*bad*". If vPattern is a pattern which DOES contain one of the special characters (?, *, #, [, or ]), then that pattern is not altered--the entire error message must match the pattern for the error message to be returned.
Note This function takes several seconds to cycle through all the possible errors looking for matches (it takes about 20 seconds on my 120 MHz '486).