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.comArgumentRequiredForPropertyLetOrSet = 9321A
Property LetorProperty Setprocedure declares no parameters at all - it has no value parameter to receive the value being assigned.
MS-VBAL §5.3.1.5:property-parameters = "(" [parameter-list ","] value-param ")"-value-paramis never bracketed, so it is always mandatory.ℹ️ Unable to find an official
learn.microsoft.comdocumentation link for this error.ByValArgumentNotAllowed = 9327An argument is written with the
ByValkeyword in an argument list that is not that of an invocation of an external procedure.
MS-VBAL §5.6.13.1 Argument Lists.DuplicateDeclaration = 9303The specified name is already used at this level of scope.
learn.microsoft.comDuplicateLabelDefinition = 9319A procedure declaration contains more than one statement label definition with the same label value.
MS-VBAL §5.4.1.1 Statement Labels.ℹ️ Unable to find an official
learn.microsoft.comdocumentation link for this error.EventArgumentsIncompatible = 9323The arguments of a
RaiseEventstatement are not compatible with the parameter list of the event it raises: there are too many or too few, or one cannot be passed to its parameter.
MS-VBAL §5.4.2.20 RaiseEvent Statement.EventNotDefined = 9322A
RaiseEventstatement names an event that the class module it is written in does not declare, or is not written in a class module at all.
MS-VBAL §5.4.2.20 RaiseEvent Statement.ExitDoNotWithinDoLoop = 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.comExitSubNotAllowedInFunctionOrProperty = 9332Exit Subis only valid within aSub: theExitstatement 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.FileAccessNotValidForMode = 9334The
Accessclause of anOpenstatement is not one itsFormode allows:Outputis onlyWrite,InputonlyRead, andAppendisRead WriteorWrite.👉 MS-VBAL §5.4.5.1 states the rule and names no error: the message is the platform's.
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.comInconsistentPropertyAccessors = 9320A
Property Get,Property Let, andProperty Setsharing a name declare incompatible index-parameter lists, or a property procedure with anOptionalparameter or aParamArrayshares its name with another accessor, or aProperty Set's value parameter is not typedObject,Variant, or a named class.
MS-VBAL §5.3.1.7 Property Declarations.ℹ️ The real VBE bundles all three conditions into one message: "Definitions of property procedures for the same property are inconsistent, or property procedure has an optional parameter, a ParamArray, or an invalid Set final parameter." Only the first (index-parameter equivalence) and third (Set's value type) are literal MS-VBAL static-semantics bullets; the Optional/ParamArray-implies-Get-only consequence is not spelled out verbatim in the spec text, but is confirmed by the real compiler's own error wording.
InterfaceMemberNotImplemented = 9329A class module that implements an interface does not declare the implemented name that corresponds to one of the interface's public variables or methods.
MS-VBAL §5.2.4.2 Implements Directive.InvalidEventHandler = 9326A procedure named for a
WithEventsvariable and one of the events of its class is not a valid handler of the event: it is not a subroutine, or its parameter list is not compatible with the event's.
MS-VBAL §5.3.1.8 Event Handler Declarations.InvalidEventName = 9325The name of an
Eventdeclaration contains an underscore, which is what separates the name of aWithEventsvariable from the name of the event in the name of a handler.
MS-VBAL §5.2.4.3 Event Declaration.InvalidImplementedMember = 9330A procedure named for an interface member (
InterfaceName_MemberName) does not correspond to it: it is not the kind of declaration the member needs, or its parameters or its type are not equivalent to the member's.
MS-VBAL §5.3.1.9 Implemented Name Declarations.InvalidImplementsDirective = 9328An
Implementsdirective names a class that cannot be an interface class: the class module itself, a class another directive of the module already names, one whose public members have an underscore in their names, or one whose name collides with another interface's; or two interfaces have names one of which begins with the other followed by an underscore.
MS-VBAL §5.2.4.2 Implements Directive.InvalidParamArrayUse = 9305The parameter defined as a
ParamArrayis used incorrectly in the procedure.
learn.microsoft.comInvalidReDim = 9306Not every VBArrayValue can be redimensioned.
learn.microsoft.comInvalidUseOfMe = 9317An instance expression (
Me) is invalid outside a class module.
MS-VBAL 5.6.11 Instance Expressions.InvalidUseOfObject = 9304You tried to use an object in an incorrect way.
learn.microsoft.comInvalidWithEventsType = 9324A
WithEventsvariable is not declared as a specific class that has at least one event, or is declared as the class of the module that contains it.
MS-VBAL §5.2.3.1.2 WithEvents Variable Declarations.LabelNotDefined = 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.NumericLiteralOverflow = 42A numeric literal's value falls outside the range of its type: a decimal literal that overflows its type-declaration suffix (
99999%), an unsuffixed integer or floating-point literal that overflows to infinity, or an unsuffixed&H…/&O…radix literal past 32 bits. See MS-VBAL §3.3.2.SubOrFunctionNotDefined = 9331The code calls a procedure, or uses a statement, that the language it is written in does not have:
Print "x"in a language where a barePrintis the member of a form there is none of, or a symbol only another language's library declares.
learn.microsoft.comSyntaxError = 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.comVariableRequired = 9333An expression that is not a variable is where a variable is required: the target of a
Midstatement, the variable aLine Input #,Input #orGetstatement reads into.
learn.microsoft.comWithExpressionOutsideWithBlock = 9318A with-expression (
.memberor!member) appears where there is no enclosingWithblock to supply its implicit owner.
MS-VBAL §5.6.15 With Expressions.ℹ️ Unable to find an official
learn.microsoft.comdocumentation link for this error.
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.