Table of Contents

Enum VBCompileErrorId

Namespace
RDCore.SDK.Model.Errors
Assembly
RDCore.SDK.dll

Formally encodes a range of integer values for all VBSyntaxErrorInfo and VBCompileErrorInfo errors.

public enum VBCompileErrorId

Fields

AmbiguousName = 9301

An identifier conflicts with another identifier or requires qualification.
learn.microsoft.com

ArgumentNotOptional = 9339

An object stands for the value of its default member where a value is expected - an operand, an argument of a parameter that takes a value, the value of a Let assignment to a variable of a value type - and its default member takes an argument that nothing gives it: a Collection, whose Item takes the key it reads.
MS-VBAL §5.5.1.1 Let-coercion (static semantics), §5.5.1.2.13.

👉 The specification asks only for an "accessible default Property Get or function"; MS-VBA also asks that it can be called with no arguments (recorded in Excel), as calling it at run time does (§5.5.1.2.13's "simple data value").

ArgumentRequiredForPropertyLetOrSet = 9321

A Property Let or Property Set procedure 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-param is never bracketed, so it is always mandatory.

ℹ️ Unable to find an official learn.microsoft.com documentation link for this error.

ArrayAlreadyDimensioned = 9357

A ReDim statement re-dimensions an array declared with fixed dimensions.
MS-VBAL §5.4.3.3 ReDim Statement.

ArrayArgumentMustBeByRef = 9371

An argument of an array parameter of a procedure of the workspace is written ByVal: an array parameter is ByRef, and an array is never passed by value.
MS-VBAL §5.6.13.1 Argument Lists.

AssignmentToConstantNotPermitted = 9346

The target of an assignment is a constant - one the code declares with Const, or a member of an enumeration.
MS-VBAL §5.4.3.8 Let Statement.

AutomationTypeNotSupported = 9373

A name written as a type is a procedural module of a referenced library, VBA.Strings: a module declares members, and is no type of a value.
MS-VBAL §5.6.16.7 Type Expressions.

BlockIfWithoutEndIf = 48

A block If has no End If statement before the end of its procedure.
MS-VBAL §5.4.2.8 If Statement.

ByRefArgumentTypeMismatch = 9361

A variable is passed to a ByRef parameter declared as another type: the parameter would be a second name for a variable of a type it is not.
MS-VBAL §5.3.1.11 Procedure Invocation Argument Processing.

ByValArgumentNotAllowed = 9327

An argument is written with the ByVal keyword in an argument list that is not that of an invocation of an external procedure.
MS-VBAL §5.6.13.1 Argument Lists.

CantAssignToArray = 9360

An array declared with fixed dimensions is assigned an array.
MS-VBAL §5.4.3.8 Let Statement.

CantAssignToReadOnlyProperty = 9341

A Let statement assigns a member of an object whose class declares a Property Get of that name and no Property Let to assign it with.
MS-VBAL §5.4.3.8 Let Statement.

CantChangeDataTypesOfArrayElements = 9369

A ReDim statement states an element type other than the one the array is declared with.
MS-VBAL §5.4.3.3 ReDim Statement.

CaseWithoutSelectCase = 50

A Case clause belongs to no Select Case statement: none is open where it is written.
MS-VBAL §5.4.2.10 Select Case Statement.

ConstantExpressionRequired = 9350

The value of a constant, or a bound of an array declared with Dim, is not a constant expression: it reads a variable or calls a function.
MS-VBAL §5.6.16.1 Constant Expressions.

DivisionByZero = 9353

The value of a constant, evaluated statically, divides by zero.
MS-VBAL §5.6.16.1 Constant Expressions.

DoWithoutLoop = 46

A Do loop has no Loop statement before the end of its procedure.
MS-VBAL §5.4.2.6 Do Statement.

DuplicateDeclaration = 9303

The specified name is already used at this level of scope.
learn.microsoft.com

DuplicateLabelDefinition = 9319

A 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.com documentation link for this error.

ElseWithoutIf = 49

An Else statement belongs to no block If: none is open where it is written.
MS-VBAL §5.4.2.8 If Statement.

EndIfWithoutBlockIf = 47

An End If statement ends no block If: none is open where it is written.
MS-VBAL §5.4.2.8 If Statement.

EndWithWithoutWith = 52

An End With statement ends no With block: none is open where it is written.
MS-VBAL §5.4.2.21 With Statement.

EventArgumentsIncompatible = 9323

The arguments of a RaiseEvent statement 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 = 9322

A RaiseEvent statement 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 = 9312

Exit Do is only valid within a Do...Loop statement.
learn.microsoft.com

ExitForNotWithinForNext = 9313

Exit For is only valid with a For...Next statement.
learn.microsoft.com

ExitFunctionNotAllowedInSubOrProperty = 9314

Exit statement must match the kind of procedure in which it occurs.
learn.microsoft.com

👉 Here "Property" must be read as Property Let or Property Set, because in MS-VBA Exit Function can legally exist inside a Property Get procedure (VBIDE accepts and corrects it)

ExitPropertyNotAllowedInSubOrFunction = 9315

Exit statement must match the kind of procedure in which it occurs.
learn.microsoft.com

ExitSubNotAllowedInFunctionOrProperty = 9332

Exit Sub is only valid within a Sub: the Exit statement must match the kind of procedure in which it occurs.
learn.microsoft.com

ExpectedArray = 9307

A variable name with a subscript indicates the variale is a VBArrayValue.
learn.microsoft.com

ExpectedEndWith = 53

A With block has no End With statement before the end of its procedure.
MS-VBAL §5.4.2.21 With Statement.

ExpectedFunctionOrVariable = 9340

A subroutine is written where a value is expected - an operand, an argument, the value of an assignment - and a subroutine has none: only a value, a variable, a property or a function can be evaluated to a data value.
MS-VBAL §5.6.2.1 Evaluation to a data value.

ExpectedIdentifier = 9308

Syntax specifies an identifier name in this context, but none was supplied.

ℹ️ Unable to find an official learn.microsoft.com documentation link for this error.

ExpectedProcedureNotVariable = 9370

A call statement is written on a variable of a module, which is no procedure to call.
MS-VBAL §5.4.2.1 Call Statement.

ExpectedSubFunctionOrProperty = 9364

A Call statement calls something that is not a procedure: a variable, a constant.
MS-VBAL §5.4.2.1 Call Statement.

ExpectedUserDefinedTypeNotProject = 9374

A name written as a type is a project or a library, VBA: a project holds modules and types, and is no type of a value.
MS-VBAL §5.6.16.7 Type Expressions.

ExpectedVariableOrProcedureNotEnumType = 9377

An enumeration, Color, is written where a value, a variable or a procedure is: its members are values, and it is none.
MS-VBAL §5.6.10 Simple Name Expressions, §5.6.12 Member Access Expressions.

ExpectedVariableOrProcedureNotModule = 9363

The name of a procedural module is written where a value, a variable or a procedure is expected: a module is none of them, and only qualifies the names of its members.
MS-VBAL §5.6.10 Simple Name Expressions.

ExpectedVariableOrProcedureNotProject = 9376

A project or a library, VBA, is written where a value, a variable or a procedure is: a project qualifies the names of what it declares, and is none of them.
MS-VBAL §5.6.10 Simple Name Expressions, §5.6.12 Member Access Expressions.

FileAccessNotValidForMode = 9334

The Access clause of an Open statement is not one its For mode allows: Output is only Write, Input only Read, and Append is Read Write or Write.

👉 MS-VBAL §5.4.5.1 states the rule and names no error: the message is the platform's.

ForControlVariableAlreadyInUse = 9358

A For loop is controlled by the variable of a For loop it is nested in.
MS-VBAL §5.4.2.3 For Statement.

ForEachMayOnlyIterateOverACollectionObjectOrAnArray = 9379

A For Each loop iterates what is no array and no object: it has no elements to iterate.
MS-VBAL §5.4.2.4 For Each Statement.

ForWithoutNext = 44

A For loop has no Next statement before the end of its procedure.
MS-VBAL §5.4.2.3 For Statement.

ForbiddenWithOptionStrict = 8000

An Option Strict directive 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.NET Option Strict statement (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.com

FunctionCallOnLeftHandSideMustReturnVariantOrObject = 9355

The target of a Let statement is a call of a function that returns neither a Variant nor an object, whose default member could be assigned.
MS-VBAL §5.4.3.8 Let Statement.

InconsistentPropertyAccessors = 9320

A Property Get, Property Let, and Property Set sharing a name declare incompatible index-parameter lists, or a property procedure with an Optional parameter or a ParamArray shares its name with another accessor, or a Property Set's value parameter is not typed Object, 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 = 9329

A 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.

InvalidDataTypeForConstant = 9351

The value of a constant is of a type no constant can have: an object - the Nothing literal.
MS-VBAL §5.2.3.2 Constant Declarations.

InvalidEventHandler = 9326

A procedure named for a WithEvents variable 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 = 9325

The name of an Event declaration contains an underscore, which is what separates the name of a WithEvents variable from the name of the event in the name of a handler.
MS-VBAL §5.2.4.3 Event Declaration.

InvalidImplementedMember = 9330

A 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 = 9328

An Implements directive 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.

InvalidLengthForFixedLengthString = 9375

A fixed-length String * n is declared with a length it cannot be: less than 1, or more than 65526 characters.
MS-VBAL §5.2.3.1.4 Variable Type Declarations.

InvalidNextControlVariableReference = 9359

The variable a Next statement names is not the control variable of the For loop it ends.
MS-VBAL §5.4.2.3 For Statement.

InvalidOutsideProcedure = 54

A statement that runs is written in the declarations section of a module, outside any procedure.
MS-VBAL §5.1 Module Body Structure.

InvalidParamArrayUse = 9305

The parameter defined as a ParamArray is used incorrectly in the procedure.
learn.microsoft.com

InvalidQualifier = 9354

A member is accessed on an expression of a type that has no members: a number, a String, a Boolean or a Date.
MS-VBAL §5.6.12 Member Access Expressions.

InvalidReDim = 9306

Not every VBArrayValue can be redimensioned.
learn.microsoft.com

InvalidUseOfAddressOf = 9367

An AddressOf expression names a member of a class module, or of an object: only a procedure of a standard module has an address.
MS-VBAL §5.6.16.8 AddressOf Expressions.

InvalidUseOfMe = 9317

An instance expression (Me) is invalid outside a class module.
MS-VBAL 5.6.11 Instance Expressions.

InvalidUseOfNewKeyword = 9368

A variable is declared As New of a type that is no class, or of a class it cannot create, or is declared WithEvents as well.
MS-VBAL §5.2.3.1.4 Variable Type Declarations, §5.2.3.1.2 WithEvents Variable Declarations.

InvalidUseOfObject = 9304

You tried to use an object in an incorrect way.
learn.microsoft.com

InvalidUseOfProperty = 9345

A Set statement assigns a member of an object whose class declares a Property Get of that name and no Property Set to assign it with.
MS-VBAL §5.4.3.9 Set Statement.

InvalidWithEventsType = 9324

A WithEvents variable 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.

LSetAllowedOnlyOnStringsAndUserDefinedTypes = 9343

The target of an LSet statement is declared as a type other than String, Variant or a user-defined type.
MS-VBAL §5.4.3.6 LSet Statement.

LabelNotDefined = 9309

A line label or line number is referred to (for example in a GoTo statement), but doesn't occur within the scope of the reference.
learn.microsoft.com

LoopWithoutDo = 45

A Loop statement ends no Do loop: none is open where it is written.
MS-VBAL §5.4.2.6 Do Statement.

MemberAlreadyExistsInDesigner = 9372

A form module's code declares a member with the name of one of the form's controls, which the form's designer already declares a field of the form's class for.

ℹ️ Unable to find an official learn.microsoft.com documentation link for this error. MS-VBA reports it with this message (recorded in Excel).

MethodOrDataMemberNotFound = 9316

The collection, object, or user-defined type (UDT) doesn't contain the referenced member.
learn.microsoft.com

ℹ️ The learn.microsoft.com documentation 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.

ModuleIsNotAValidType = 9366

A declaration names a procedural module as its type: a module declares members, and is no type of a value.
MS-VBAL §5.6.4 Expression Binding Contexts.

NamedArgumentAlreadySpecified = 9348

A call names the same parameter twice, or names a parameter a positional argument is already given to.
MS-VBAL §5.6.13.1 Argument Lists.

NamedArgumentNotFound = 9349

A call names a parameter the procedure does not declare.
MS-VBAL §5.6.13.1 Argument Lists.

NextWithoutFor = 43

A Next statement ends no For loop: none is open where it is written.
MS-VBAL §5.4.2.3 For Statement.

NotAllowedAsPublicMemberOfObjectModule = 9337

A class module declares a constant, a fixed-length string, an array, a user-defined type or a Declare statement as a public member: what an object module exposes is reached through an object, which has no room for them.
MS-VBAL §5.2.3.1 Variable Declarations.

NumericLiteralOverflow = 42

A 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.

ObjectRequired = 9347

The target of a Set statement is declared as a type that holds no object.
MS-VBAL §5.4.3.9 Set Statement.

OnlyCommentsAfterEndProcedure = 55

A statement or a declaration is written after the first procedure of a module, where only procedures and comments may be.
MS-VBAL §5.1 Module Body Structure.

Overflow = 9352

The value of a constant, evaluated statically, does not fit its declared type.
MS-VBAL §5.6.16.1 Constant Expressions.

PrivateTypeInPublicMember = 9336

A public member names a private Enum in its signature - the type of a public variable, of a parameter or the result of a public procedure, of a field of a public user-defined type - or, in a class module, a private user-defined type.
MS-VBAL §5.2.3.1 Variable Declarations, §5.3.1 Procedure Declarations.

👉 The message says "user defined types", but MS-VBA accepts a private user-defined type in the public members of a procedural module (recorded in Excel): in a procedural module only a private Enum is refused.

PublicUserDefinedTypeInObjectModule = 9338

A class module declares a Public Type: a user-defined type of an object module is private to it.
MS-VBAL §5.2.3.3 User Defined Type Declarations.

RSetAllowedOnlyOnStrings = 9344

The target of an RSet statement is declared as a type other than String or Variant.
MS-VBAL §5.4.3.7 RSet Statement.

RangeHasNoValues = 9365

A dimension of an array is declared with an upper bound less than its lower bound.
MS-VBAL §5.2.3.1.3 Array Dimensions and Bounds.

SelectCaseWithoutEndSelect = 51

A Select Case statement has no End Select before the end of its procedure.
MS-VBAL §5.4.2.10 Select Case Statement.

SubOrFunctionNotDefined = 9331

The 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 bare Print is the member of a form there is none of, or a symbol only another language's library declares.
learn.microsoft.com

SyntaxError = 1

A generic "Syntax error" compile-time error.
learn.microsoft.com

👉 RDCore.Parsing should be giving us much more detailed syntax errors that this.

TypeDeclarationCharacterDoesNotMatch = 9335

A name is written with a type-declaration character (%, &, ^, !, #, @ or $) that is not the type it was declared as: x$ = "a" is fine and x% = 42 is not, when x is a String.
learn.microsoft.com

TypeMismatch = 9310

The 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.com documentation 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.

TypeMismatchArrayOrUserDefinedTypeExpected = 9362

An array is passed to a parameter declared as an array of another type.
MS-VBAL §5.3.1.11 Procedure Invocation Argument Processing.

UnspecifiedCompileError = 0

A fallback error ID for a compilation error.

⚠️ This value may not reliably be interpreted as a valid compilation error ID.

UserDefinedTypeNotDefined = 9311

The 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 = 9302

You use the Option Explicit directive 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

VariableRequired = 9333

An expression that is not a variable is where a variable is required: the target of a Mid statement, the variable a Line Input #, Input # or Get statement reads into.
learn.microsoft.com

WithExpressionOutsideWithBlock = 9318

A with-expression (.member or !member) appears where there is no enclosing With block to supply its implicit owner.
MS-VBAL §5.6.15 With Expressions.

ℹ️ Unable to find an official learn.microsoft.com documentation link for this error.

WithObjectMustBeUserDefinedTypeObjectOrVariant = 9378

A With block is about a value that is no object, no record and no Variant: it has no members to refer to.
MS-VBAL §5.4.2.21 With Statement.

WrongNumberOfArgumentsOrInvalidPropertyAssignment = 9342

A procedure is called with more arguments than it declares parameters, or with a named argument when it declares none.
MS-VBAL §5.6.13.1 Argument Lists, §5.3.1.11 Procedure Invocation Argument Processing.

WrongNumberOfDimensions = 9356

An element of an array declared with fixed dimensions is selected by a number of subscripts that is not its number of dimensions.
MS-VBAL §5.6.13 Index Expressions.

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.