Table of Contents

Interface IStdInformationModule

Namespace
RDCore.SDK.Runtime.Abstract.StdLib
Assembly
RDCore.SDK.dll

MS-VBAL 6.1.2.7 Information Module

[StdLibModule(null)]
public interface IStdInformationModule

Remarks

Formalizes the public interface of the standard library VBA.Information module.

Methods

Erl()

Gets the line number the most recent run-time error was raised at — the nearest line-number label at or before the faulting statement, or 0 when none precedes it.

RuntimeSemanticsEvaluationResult<VBLongValue> Erl()

Returns

RuntimeSemanticsEvaluationResult<VBLongValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

👉 Not a member MS-VBAL documents at all, and hidden in MS-VBA, which nonetheless exposes it from this module. A line number is sticky: it labels every statement after it until the next one, so this answers for a statement that carries no label of its own. A named label never sets it.

🎯 RD-VBA returns a Long where MS-VBA returns ushort resolution. A deliberate divergence: MS-VBA wraps Erl around on any line number that does not fit, so a program numbered past 65535 is told it faulted at a line it has not got. Widening it costs nothing and makes every legal line number label representable.

Err()

MS-VBAL 6.1.3.2 Err Class Gets the error object: the single ErrObject instance reflecting the error state of the active VBA environment.

[StdLibMember(null, ReturnType = typeof(IStdErrClass))]
RuntimeSemanticsEvaluationResult<VBObjectValue> Err()

Returns

RuntimeSemanticsEvaluationResult<VBObjectValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

👉 Not a member MS-VBAL lists under this module: §6.1.3.2 describes the error object as the default instance of a global class module named Err, while MS-VBA exposes it as this zero-argument function of Information, returning an instance of a class named ErrObject. The two are the same thing seen from source — a bare Err yields the error object either way, because a standard module's members are promoted to the project scope — and this is the arrangement that also makes ErrObject nameable in an As clause.

IMEStatus()

MS-VBAL 6.1.2.7.1.1 IMEStatus

[StdLibMember(null, ReturnType = typeof(VBIMEStatus))]
RuntimeSemanticsEvaluationResult<VBLongValue> IMEStatus()

Returns

RuntimeSemanticsEvaluationResult<VBLongValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Returns a VBIMEStatus value representing the current implementation-dependant Input Method Editor (IME) mode.

IsArray(VBVariantValue)

MS-VBAL 6.1.2.7.1.2 IsArray

RuntimeSemanticsEvaluationResult<VBBooleanValue> IsArray(VBVariantValue arg)

Parameters

arg VBVariantValue

The data value to be tested

Returns

RuntimeSemanticsEvaluationResult<VBBooleanValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Tests a provided value to check if it is a VBArrayValue, whether it has any elements or not.

👉 An object is tested by the value of its default member (MS-VBAL §5.5.1.2.13), which is how MS-VBA tests every argument of the Is functions save IsObject and IsMissing: an object whose default member returns an array is an array here, and an error its default member raises is raised.

IsDate(VBVariantValue)

MS-VBAL 6.1.2.7.1.3 IsDate

RuntimeSemanticsEvaluationResult<VBBooleanValue> IsDate(VBVariantValue arg)

Parameters

arg VBVariantValue

The data value to be tested

Returns

RuntimeSemanticsEvaluationResult<VBBooleanValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Tests a provided value to check if it is a VBDateValue, or a VBStringValue that can be Let-coerced to one (MS-VBAL §5.5.1.2.4). A number is not a date, though it Let-coerces to one.

🎯 A string that Let-coerces to a Date only by being read as a number - "2000", "1" - is not a date either: MS-VBA says False for it, the specification's wording notwithstanding, and so does RD-VBA. It is a date where it reads as a date or a time.

👉 An object is tested by the value of its default member, as in IsArray(VBVariantValue).

IsEmpty(VBVariantValue)

MS-VBAL 6.1.2.7.1.4 IsEmpty

RuntimeSemanticsEvaluationResult<VBBooleanValue> IsEmpty(VBVariantValue arg)

Parameters

arg VBVariantValue

The data value to be tested

Returns

RuntimeSemanticsEvaluationResult<VBBooleanValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Tests a provided value to check if it is a VBEmptyValue.

👉 An object is tested by the value of its default member, as in IsArray(VBVariantValue): an Excel cell that holds nothing is empty.

IsError(VBVariantValue)

MS-VBAL 6.1.2.7.1.5 IsError

RuntimeSemanticsEvaluationResult<VBBooleanValue> IsError(VBVariantValue arg)

Parameters

arg VBVariantValue

The data value to be tested

Returns

RuntimeSemanticsEvaluationResult<VBBooleanValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Tests a provided value to check if it is a VBErrorValue - the Missing value being one.

👉 An object is tested by the value of its default member, as in IsArray(VBVariantValue).

IsMissing(VBVariantValue)

MS-VBAL 6.1.2.7.1.6 IsMissing

RuntimeSemanticsEvaluationResult<VBBooleanValue> IsMissing(VBVariantValue arg)

Parameters

arg VBVariantValue

The data value to be tested

Returns

RuntimeSemanticsEvaluationResult<VBBooleanValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Tests a provided value to check if it is a VBMissingValue.
👉 The value can only be a VBMissingValue if it is the VBVariantValue of an optional parameter that was not supplied, or a copy of one: a Variant assigned from it, or another optional parameter it is passed on to.

🎯 A Variant array with no elements is missing too. The specification says IsMissing "always returns False" for a ParamArray; MS-VBA returns True for one that collected no arguments, and for any other zero-element Variant array it is given - IsMissing(Array()) - and so does RD-VBA. A ParamArray that collected any argument is not missing. Nor is a variable declared as an array (Dim e() As Variant), which is passed by reference as the array it is (StdLibByRefAttribute), and not as a Variant that holds one: False for an empty one, in MS-VBA.

IsNull(VBVariantValue)

MS-VBAL 6.1.2.7.1.7 IsNull

RuntimeSemanticsEvaluationResult<VBBooleanValue> IsNull(VBVariantValue arg)

Parameters

arg VBVariantValue

The data value to be tested

Returns

RuntimeSemanticsEvaluationResult<VBBooleanValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Tests a provided value to check if it is a VBNullValue.

👉 An object is tested by the value of its default member, as in IsArray(VBVariantValue).

IsNumeric(VBVariantValue)

MS-VBAL 6.1.2.7.1.8 IsNumeric

RuntimeSemanticsEvaluationResult<VBBooleanValue> IsNumeric(VBVariantValue arg)

Parameters

arg VBVariantValue

The data value to be tested

Returns

RuntimeSemanticsEvaluationResult<VBBooleanValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Tests a provided value to check if it is a VBNumericTypedValue or a VBBooleanValue.

🎯 The specification lists only the numeric value types and Boolean. MS-VBA also says True for Empty, and for a VBStringValue that can be Let-coerced to a Double (MS-VBAL §5.5.1.2.4) - "1e3", " -1 " - and so does RD-VBA. A Date is not numeric, though it Let-coerces to a number.

👉 An object is tested by the value of its default member, as in IsArray(VBVariantValue).

IsObject(VBVariantValue)

MS-VBAL 6.1.2.7.1.9 IsObject

RuntimeSemanticsEvaluationResult<VBBooleanValue> IsObject(VBVariantValue arg)

Parameters

arg VBVariantValue

The data value to be tested

Returns

RuntimeSemanticsEvaluationResult<VBBooleanValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Tests a provided value to check if it is a VBObjectValue - Nothing included. Unlike the other Is functions, it never reads an object's default member.

QBColor(VBIntegerValue)

MS-VBAL 6.1.2.7.1.10 QBColor

RuntimeSemanticsEvaluationResult<VBLongValue> QBColor(VBIntegerValue color)

Parameters

color VBIntegerValue

A value in the 0-15 range naming one of the legacy 16-bit colors.

Returns

RuntimeSemanticsEvaluationResult<VBLongValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Gets the RGB color value for a specified color value used by earlier versions of Visual Basic.

RGB(VBIntegerValue, VBIntegerValue, VBIntegerValue)

MS-VBAL 6.1.2.7.1.11 RGB

RuntimeSemanticsEvaluationResult<VBLongValue> RGB(VBIntegerValue red, VBIntegerValue green, VBIntegerValue blue)

Parameters

red VBIntegerValue

A value in the VBByteValue range (0-255) representing the red component of the color.

green VBIntegerValue

A value in the VBByteValue range (0-255) representing the green component of the color.

blue VBIntegerValue

A value in the VBByteValue range (0-255) representing the blue component of the color.

Returns

RuntimeSemanticsEvaluationResult<VBLongValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Gets a VBLongValue representing a RGB color value from its specified parts: blue * 65536 + green * 256 + red.

🎯 The specification's formula takes max(x, 255) of each part, which would make every color white: it means the smaller of the two. A part above 255 counts as 255, and a negative part raises run-time error 5 (InvalidProcedureCallOrArgument), as in MS-VBA. Each argument is Let-coerced to Integer first, so a fractional part rounds to even and one outside the Integer range overflows.

TypeName(VBVariantValue)

MS-VBAL 6.1.2.7.1.12 TypeName

RuntimeSemanticsEvaluationResult<VBStringValue> TypeName(VBVariantValue arg)

Parameters

arg VBVariantValue

The data value to name the type of.

Returns

RuntimeSemanticsEvaluationResult<VBStringValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Gets the name of the data type of the specified value.
👉 If the provided value is a VBArrayValue, the returned string contains the item data type of the array appended with a pair of empty parentheses, e.g. "Byte()" for an array of VBByteValue items.

An object is named by its class - a workspace class module's name, "Collection", "ErrObject", or the name a referenced library gives the class, such as "Dictionary" - whatever the variable holding it was declared as; and Nothing is "Nothing". Its default member is never read. An array of objects is "Object()" whatever class its elements are declared as, as MS-VBA has it; an array of an Enum is "Long()", and a LongPtr is named for the type it is on the platform, "LongLong" on a 64-bit one.

VarType(VBVariantValue)

MS-VBAL 6.1.2.7.1.13 VarType

[StdLibMember(null, ReturnType = typeof(VBVarType))]
RuntimeSemanticsEvaluationResult<VBLongValue> VarType(VBVariantValue varName)

Parameters

varName VBVariantValue

The data value to report the subtype of.

Returns

RuntimeSemanticsEvaluationResult<VBLongValue>

A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.

Remarks

Gets the subtype of the specified VBVariantValue.
👉 An array's subtype is VBArray combined with the item data type of the array, e.g. 8209 for an array of VBByteValue items.

An object reports the subtype of its default member's value (MS-VBAL §5.5.1.2.13), as MS-VBA documents and does: VarType(Err) is VBLong, being Err.Number's. That value is not read again when it is itself an object. An object whose class has no default member callable with no arguments - Nothing, a Collection - is VBObject, and an error its default member raises is raised.