Error Codes
Visual Basic's Err object returns the number associated with the current error condition in its Number property (Err.Number). The Error() function takes this error number as its argument, and returns a string containing a description of the error. The Visual Basic error codes are listed below.
| Visual Basic Error Codes | |
| Code | Description |
| 3 | Return without GoSub. |
| 5 | Invalid procedure call or argument. |
| 6 | Overflow. |
| 7 | Out of memory. |
| 8 | Application-defined or object-defined error. |
| 9 | Subscript out of range. |
| 10 | This array is fixed or temporarily locked. |
| 11 | Division by zero. |
| 13 | Type mismatch. |
| 14 | Out of string space. |
| 16 | Expression too complex. |
| 17 | Can't perform requested operation. |
| 18 | User interrupt occurred. |
| 20 | Resume without error. |
| 28 | Out of stack space. |
| 35 | Sub or Function not defined. |
| 47 | Too many DLL application clients. |
| 48 | Error in loading DLL. |
| 49 | Bad DLL calling convention. |
| 51 | Internal error. |
| 52 | Bad file name or number. |
| 53 | File not found. |
| 54 | Bad file mode. |
| 55 | File already open. |
| 57 | Device I/O error. |
| 58 | File already exists. |
| 59 | Bad record length. |
| 61 | Disk full. |
| 62 | Input past end of file. |
| 63 | Bad Record number. |
| 67 | Too many files. |
| 68 | Device unavailable. |
| 70 | Permission denied. |
| 71 | Disk not ready. |
| 74 | Can't rename with different drive. |
| 75 | Path/File access error. |
| 76 | Path not found. |
| 91 | Object variable or With block variable not set. |
| 92 | For loop not initialized. |
| 93 | Invalid pattern string. |
| 94 | Invalid use of Null. |
| 96 | Unable to sink events of object because the object is already firing events to the maximum number of event receivers that it supports. |
| 97 | Cannot call friend function on object, which is not an instance of defining class. |
| 98 | A property or method call cannot include a reference to a private object, either as an argument or as a return value. |
| 321 | Invalid file format. |
| 322 | Can't create necessary temporary file. |
| 325 | Invalid format in resource file. |
| 380 | Invalid property value. |
| 381 | Invalid property array index. |
| 382 | Set not supported at runtime. |
| 383 | Set not supported (read-only property). |
| 385 | Need property array index. |
| 387 | Set not permitted. |
| 393 | Get not supported at runtime. |
| 394 | Get not supported (write-only property). |