Interface IStdHiddenModule
RD-VBAL 6.1.2.13 Hidden Module
[StdLibModule("_HiddenModule", IsHidden = true)]
public interface IStdHiddenModule
Remarks
Formalizes the public interface of the standard library's _HiddenModule: the members of the VBA library
that its type library marks hidden, and that an object browser lists under that name. It is not one of the modules
MS-VBAL §6.1.2 specifies, but the language needs it all the same - Array is documented
(https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/array-function) and
Input$ and Width are as old as the language - so the platform declares it as it does the modules the
specification does name. What the hidden members share is that a hidden member is left out of a completion list and
resolves anyway, being a member of a standard module like any other.
The pointer members (ObjPtr, StrPtr, VarPtr) are not documented by Microsoft even so, nor specified by MS-VBAL; what they
give is what MS-VBA gives, recorded in Excel: addresses in the session's memory, where a variable, a String's characters and an
object's interface are laid out as MS-VBA lays them out, and PEEK and POKE read and write them (RD-VBAL §2.3.1.2, the memory model).
Methods
Array(params VBVariantValue[])
Array Gets a Variant containing an array of the arguments.
RuntimeSemanticsEvaluationResult<VBVariantValue> Array(params VBVariantValue[] arglist)
Parameters
arglistVBVariantValue[]The values the elements of the array are given.
Returns
- RuntimeSemanticsEvaluationResult<VBVariantValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
The array is a resizable array of Variant, with one element for each argument, in order. With no arguments it is
zero-length: its upper bound is one below its lower.
Its lower bound is always 0, whatever Option Base says. That is the one a call qualified with the name of
the library reaches - VBA.Array(1, 2) - and the classic gotcha of the language: written without a qualifier,
Array(1, 2) is not a call of this member but the Array keyword, which begins at the Option Base
of its module (ArrayExpressionNode).
Input(VBLongValue, VBIntegerValue)
Input Gets the characters read from a file opened in Input or Binary mode.
RuntimeSemanticsEvaluationResult<VBVariantValue> Input(VBLongValue number, VBIntegerValue fileNumber)
Parameters
numberVBLongValueThe number of characters to read.
fileNumberVBIntegerValueThe file number of an open file.
Returns
- RuntimeSemanticsEvaluationResult<VBVariantValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
Error 62 when the file ends before number characters could be read, 52 when the file number is not open,
and 54 when the file was opened in a mode that cannot be read this way. The characters read are the string; unlike
Input #, nothing is parsed, and a quotation mark or a comma is a character like any other.
InputB(VBLongValue, VBIntegerValue)
InputB Gets the bytes read from a file, as Input(VBLongValue, VBIntegerValue) gets characters.
RuntimeSemanticsEvaluationResult<VBVariantValue> InputB(VBLongValue number, VBIntegerValue fileNumber)
Parameters
numberVBLongValueThe number of bytes to read.
fileNumberVBIntegerValueThe file number of an open file.
Returns
- RuntimeSemanticsEvaluationResult<VBVariantValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
The bytes as they are in the file, not the characters they encode: a String of number bytes, which StrConv(…, vbUnicode)
reads as characters. It reads at the same position Input(VBLongValue, VBIntegerValue) does, on a file opened for Input or Binary: on any other, it is error
54 (Bad file mode); past the end of the file, error 62.
InputBString(VBLongValue, VBIntegerValue)
InputB Gets the bytes read from a file, as Input(VBLongValue, VBIntegerValue) gets characters.
[StdLibMember("InputB$")]
RuntimeSemanticsEvaluationResult<VBStringValue> InputBString(VBLongValue number, VBIntegerValue fileNumber)
Parameters
numberVBLongValueThe number of bytes to read.
fileNumberVBIntegerValueThe file number of an open file.
Returns
- RuntimeSemanticsEvaluationResult<VBStringValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
The bytes as they are in the file, not the characters they encode: a String of number bytes, which StrConv(…, vbUnicode)
reads as characters. It reads at the same position Input(VBLongValue, VBIntegerValue) does, on a file opened for Input or Binary: on any other, it is error
54 (Bad file mode); past the end of the file, error 62.
InputString(VBLongValue, VBIntegerValue)
Input Gets the characters read from a file opened in Input or Binary mode.
[StdLibMember("Input$")]
RuntimeSemanticsEvaluationResult<VBStringValue> InputString(VBLongValue number, VBIntegerValue fileNumber)
Parameters
numberVBLongValueThe number of characters to read.
fileNumberVBIntegerValueThe file number of an open file.
Returns
- RuntimeSemanticsEvaluationResult<VBStringValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
Error 62 when the file ends before number characters could be read, 52 when the file number is not open,
and 54 when the file was opened in a mode that cannot be read this way. The characters read are the string; unlike
Input #, nothing is parsed, and a quotation mark or a comma is a character like any other.
ObjPtr(VBLongLongValue)
ObjPtr Gets the address of an interface of an object in the session's memory.
[StdLibMember(null, IsHidden = true)]
RuntimeSemanticsEvaluationResult<VBLongPtrValue> ObjPtr(VBLongLongValue ptr)
Parameters
ptrVBLongLongValueThe address of the object variable.
Returns
- RuntimeSemanticsEvaluationResult<VBLongPtrValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
Declared as the VBA type library declares it, ObjPtr(Ptr As Unknown) As LongPtr, and given where its argument is
(StdLibByAddressAttribute): the interface is the one the variable it is passed is declared as. As in MS-VBA (recorded
in Excel):
Nothingis0, and an object's address is the same for as long as it lives;- a variable of the object's class, of
Object, and aVariantgive one address; a variable of an interface the class implements gives another, and one ofIUnknownanother still; - the bytes of an object variable are this address, and the first pointer at it is the same for every object of a class.
StrPtr(VBLongLongValue)
StrPtr Gets the address of the characters of a string in the session's memory.
[StdLibMember(null, IsHidden = true)]
RuntimeSemanticsEvaluationResult<VBLongPtrValue> StrPtr(VBLongLongValue ptr)
Parameters
ptrVBLongLongValueThe address of the
String.
Returns
- RuntimeSemanticsEvaluationResult<VBLongPtrValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
Declared as the VBA type library declares it, StrPtr(Ptr As String) As LongPtr, and given where its argument is
(StdLibByAddressAttribute): the characters are those of the very String it is passed, in the BSTR it is in - a Long
of its length in bytes just before them, a null character just after. As in MS-VBA (recorded in Excel):
vbNullString, and aStringvariable nothing was assigned to, is0; a zero-lengthStringis not;- a
Stringvariable, an element of aStringarray, a field of a record and aVariantholding aStringeach have their own characters, the same until anotherStringis assigned to them:t = scopies them, and so does aByValparameter; - the bytes of a
Stringvariable are this address; - what is no variable,
StrPtr("abc"), is aStringof its own until the statement is over.
VarPtr(VBLongLongValue)
VarPtr Gets the address of a variable in the session's memory.
[StdLibMember(null, IsHidden = true)]
RuntimeSemanticsEvaluationResult<VBLongPtrValue> VarPtr(VBLongLongValue ptr)
Parameters
ptrVBLongLongValueThe address of the variable.
Returns
- RuntimeSemanticsEvaluationResult<VBLongPtrValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
Declared as the VBA type library declares it, VarPtr(Ptr As Any) As LongPtr (StdLibAsAnyAttribute): it takes a variable of
any type but an array, and is given its address. As in MS-VBA (recorded in Excel):
- the address is never
0, and is the same for a variable for as long as it exists, whatever is assigned to it - the same for a module's variable named bare or qualified, and for aStaticlocal across calls; - a
ByRefparameter's is the address of the variable it was given, and aByValparameter's its own; aVariantone given a variable of another type is aVARIANTof its own, at one address for the call; - what is no variable -
VarPtr(1),VarPtr(x + 0),VarPtr((x)), a public variable of an object named through it - is passed as a temporary, which has an address of its own until the statement is over; VarPtr(ByVal n)is the bytesnis stored in, read as a whole number;- an element of an array is in a block of the array's elements side by side, and a field of a record at its offset in the record, as MS-VBA lays them out.
Width(VBIntegerValue, VBIntegerValue)
Width Sets the line width of a file opened for output: the number of characters a line holds before
Print # and Write # start another (MS-VBAL §5.4.5.7).
RuntimeSemanticsEvaluationResult Width(VBIntegerValue fileNumber, VBIntegerValue width)
Parameters
fileNumberVBIntegerValueThe file number of an open file.
widthVBIntegerValueThe width, from 0 (no limit) to 255.
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
The Width statement is this member called without parentheses: Width #1, 80.