Table of Contents

6.1.1 Predefined Enums

Note

This section describes the implementation of MS-VBAL §6.1.1 Predefined Enums.

RD-VBA implements all sixteen MS-VBAL §6.1.1 predefined enums. The SDK defines all sixteen, and the standard library's symbols are read off those SDK declarations (RD-VBAL §6.0.1 Symbol Injection).

§ Enum SDK declaration Notes
6.1.1.1 FormShowConstants VBFormShowConstants No naming convention recovers the name FormShowConstants, so StdLibEnumAttribute states it.
6.1.1.2 VbAppWinStyle VBAppWinStyle
6.1.1.3 VbCalendar VBCalendar
6.1.1.4 VbCallType VBCallType
6.1.1.5 VbCompareMethod VBCompareMethod
6.1.1.6 VbDateTimeFormat VBDateTimeFormat
6.1.1.7 VbDayOfWeek VBDayOfWeek
6.1.1.8 VbFileAttribute VBFileAttribute
6.1.1.9 VbFirstWeekOfYear VBFirstWeekOfYear
6.1.1.10 VbIMEStatus VBIMEStatus
6.1.1.11 VbMsgBoxResult VBMsgBoxResult
6.1.1.12 VbMsgBoxStyle VBMsgBoxStyle
6.1.1.13 VbQueryClose VBQueryClose
6.1.1.14 VbStrConv VBStrConv
6.1.1.15 VbTriState VBTriState
6.1.1.16 VbVarType VBVarType Declared in the core value model. See §6.1.1.16.

The other enum names follow the naming convention: the SDK enum VBDayOfWeek is the enum VbDayOfWeek, and its member VBSunday is the constant vbSunday.

Because an enum member is placed through its enum, an enum member such as vbSunday is a name on its own, resolvable without qualification (RD-VBAL §5.2.3.4 Enum Declarations).

6.1.1.16 VbVarType

Note

This section describes the implementation of MS-VBAL §6.1.1.16 VbVarType.

Tag Space

The VbVarType tag space is COM VARENUM-compatible. It is declared in the core value model as VBVarType (RDCore.SDK.Model.Values.Runtime.VBVarType).

A Variant's own tag is a VBVarType. VBVarType has the same numeric values that VarType() reports (RD-VBAL §6.1.2.7 Information), and the same numeric values that OLE Automation marshals a VARIANT against.

Mapping a Declared Type to a Tag

VBVarTypeExtensions.VarType maps a VBType to its VBVarType tag:

Declared type VBVarType tag
An array type (VBArrayType) The array's own tag, VBArray, combined with its element type's own tag, computed recursively.
A VBClassType whose class module is known Defers to the class module's AutomationKind (see Automation Kind).
A generic VBObjectType reference VT_DISPATCH (the Dispatch tag), by default.

A generic VBObjectType reference defaults to VT_DISPATCH because a live object's concrete class is only knowable by looking up the actual instance, which the VarType mapping has no access to. Without that lookup, VT_DISPATCH is the only sound default.

Variant Values

VBVariantValue computes its VarType, its VBVarType tag, on construction: VBVarTypeExtensions.VarType maps the wrapped value's declared type to the tag.

A Variant's VBVarType tag is carried on its VBRuntimeVariantValue box. The tag round-trips through storage alongside the value itself (RD-VBAL §2.5.2.1.5 Variant Values).

Automation Kind

VBClassModuleSymbol.AutomationKind (VBAutomationKind) distinguishes an Automation-capable (VT_DISPATCH) class module from an IUnknown-only class module. VarType consults it for any VBClassType whose class module is known.

AutomationKind Class module VBVarType tag
Dispatch (default) Automation-capable. VT_DISPATCH
Unknown IUnknown-only. vbDataObject, the sibling of VT_DISPATCH. Its tag value is 13.

AutomationKind defaults to Dispatch. Every RD-VBA class module has AutomationKind Dispatch (VT_DISPATCH) (RD-VBAL §5.2.4 Class Module Declarations).

Note

Not implemented. An IUnknown-only class module. Nothing in RD-VBA constructs a class module whose AutomationKind is Unknown, so every class module is Dispatch.


⏮️ RD-VBAL §6.1 VBA Project | ⏭️ RD-VBAL §6.1.2 Predefined Procedural Modules