Enum VBCompileErrorId
Formally encodes a range of integer values for all VBSyntaxErrorInfo and VBCompileErrorInfo errors.
public enum VBCompileErrorId
Fields
AmbiguousName = 9301An identifier conflicts with another identifier or requires qualification.
learn.microsoft.comDuplicateDeclaration = 9303The specified name is already used at this level of scope.
learn.microsoft.comExitDoNotWithinDoLoop = 9312Exit Dois only valid within aDo...Loopstatement.
learn.microsoft.comExitForNotWithinForNext = 9313Exit Foris only valid with aFor...Nextstatement.
learn.microsoft.comExitFunctionNotAllowedInSubOrProperty = 9314Exitstatement must match the kind of procedure in which it occurs.
learn.microsoft.com👉 Here "Property" must be read as
Property LetorProperty Set, because in MS-VBAExit Functioncan legally exist inside aProperty Getprocedure (VBIDE accepts and corrects it)ExitPropertyNotAllowedInSubOrFunction = 9315Exitstatement must match the kind of procedure in which it occurs.
learn.microsoft.comExpectedArray = 9307A variable name with a subscript indicates the variale is a VBArrayValue.
learn.microsoft.comExpectedIdentifier = 9308Syntax specifies an identifier name in this context, but none was supplied.
ℹ️ Unable to find an official
learn.microsoft.comdocumentation link for this error.ForbiddenWithOptionStrict = 8000An
Option Strictdirective or annotation is enforcing stricter semantics that block a number of semantic flags at compile-time:ℹ️ This is a specified error code, not (yet) a language feature.
The VB.NETOption Strictstatement (RD-VBA: "directive") is documented as follows:
🎯 Restricts implicit data type conversions to only widening conversions, disallows late binding, and disallows implicit typing that results in an Object type.
learn.microsoft.comInvalidParamArrayUse = 9305The parameter defined as a
ParamArrayis used incorrectly in the procedure.
learn.microsoft.comInvalidReDim = 9306Not every VBArrayValue can be redimensioned.
learn.microsoft.comInvalidUseOfObject = 9304You tried to use an object in an incorrect way.
learn.microsoft.comLabelNotDefined = 9309A line label or line number is referred to (for example in a
GoTostatement), but doesn't occur within the scope of the reference.
learn.microsoft.comMethodOrDataMemberNotFound = 9316The collection, object, or user-defined type (UDT) doesn't contain the referenced member.
learn.microsoft.comℹ️ The
learn.microsoft.comdocumentation documents this error as both a compile-time and a MethodOrDataMemberNotFound error.
This works only because the documentation includes run-time collection item retrieval - otherwise this error would be purely about a failed member binding.SyntaxError = 1A generic "Syntax error" compile-time error.
learn.microsoft.com👉
RDCore.Parsingshould be giving us much more detailed syntax errors that this.TypeMismatch = 9310The variable or property is of a data type that cannot be let-coerced (implicitly converted) to the specified destination type.
learn.microsoft.comℹ️ The
learn.microsoft.comdocumentation documents this error as both a compile-time and a TypeMismatch error. Since both compile-time and run-time semantics are closely related, this does make sense.UnspecifiedCompileError = 0A fallback error ID for a compilation error.
⚠️ This value may not reliably be interpreted as a valid compilation error ID.
UserDefinedTypeNotDefined = 9311The data type of a variable or parameter declaration is of an unknown, inaccessible, or otherwise invalid data type.
learn.microsoft.com👉 This error usually has absolutely nothing to do with any user-defined type (UDT) declaration. The term "user-defined" here seems to be rather standing for workspace-defined.
VariableNotDefined = 9302You use the
Option Explicitdirective to protect your modules from having undeclared variables and to eliminate the possibility of inadvertently creating new variables when typographical errors occur.
learn.microsoft.com
Remarks
👉 The members of this enum are divided into sections.
- 0 to 1: Generic system or fallback defaults.
- 2 to 41: Reserved
- 42 to 999: Reserved for RD-VBA formalized syntax errors (VBSyntaxErrorInfo).
- 1000 to 7999: Reserved
- 8000 to 9299: Reserved for future RD-VBA extensibility.
- 9300+: Formalized MS-VBA compilation errors. This list is currently vastly incomplete.
ℹ️ 93 is for 1993, the year MS-VBA came into existence.