LLSheets
Factory
Create #
Instantiate a sheet helper bound to the supplied dictionary
Signature:
Public Function Create(ByVal dict As ILLdictionary) As ILLSheets
Parameters:
dict: ILLdictionary providing sheet metadata.
Returns: ILLSheets fully initialised helper.
Internal members (not exported)
Public Accessors
Self #
Expose the interface reference of this predeclared instance
Signature:
Public Property Get Self() As ILLSheets
Returns: ILLSheets reference to the current object.
Dictionary #
Retrieve the backing dictionary
Signature:
Public Property Get Dictionary() As ILLdictionary
Returns: ILLdictionary reference captured during initialisation.
Dictionary #
Store the backing dictionary and prime cached lookups
Signature:
Public Property Set Dictionary(ByVal dict As ILLdictionary)
Parameters:
dict: ILLdictionary holding linelist metadata.
SheetRange #
Return the cached range referencing sheet names
Signature:
Private Property Get SheetRange(Optional ByVal requirePrepared As Boolean = False) As Range
Returns: Range spanning the sheet-name column including the header.
Sheet Queries
Contains #
Determine whether the dictionary includes the supplied sheet
Signature:
Private Function Contains(ByVal sheetName As String) As Boolean
Parameters:
sheetName: String. Sheet identifier to locate.
Returns: True when the sheet exists.
RowIndex #
Lookup the worksheet row hosting the sheet metadata
Signature:
Private Function RowIndex(ByVal sheetName As String) As Long
Parameters:
sheetName: String. Sheet identifier to locate.
Returns: Worksheet row index for the sheet entry, or 0 when not found.
SheetInfo #
Fetch additional metadata about a sheet
Signature:
Public Function SheetInfo(ByVal sheetName As String, Optional ByVal info As Byte = SheetInfoType.SheetInfoSheetType) As String
Parameters:
sheetName: String. Sheet identifier.info: Byte. Requested metadata selector.
Returns: Requested metadata value; raises when selector is unknown.
VarList #
Retrieve the ordered list of variables belonging to a sheet
Signature:
Private Function Varlist(ByVal sheetName As String) As BetterArray
Parameters:
sheetName: String. Sheet identifier.
Returns: BetterArray containing variable names for the sheet.
NumberVars #
Count the variables associated with a sheet
Signature:
Private Function NumberVars(ByVal sheetName As String) As Long
Parameters:
sheetName: String. Sheet identifier.
Returns: Long number of variables present on the sheet.
DataBounds #
Compute the data boundaries for a sheet layout
Signature:
Private Function DataBounds(ByVal sheetName As String, _
Optional ByVal Bound As Byte = SheetBound.RowSart) As Long
Parameters:
sheetName: String. Sheet identifier.Bound: Byte. Selector from SheetBound enumeration.
Returns: Long representing the requested bound.
ContainsControl #
Test whether a sheet exposes a control of the requested type
Signature:
Private Function ContainsControl(ByVal sheetName As String, _
Optional ByVal Control As String = "list_auto", _
Optional ByVal colName As String = COL_CONTROL) As Boolean
Parameters:
sheetName: String. Sheet identifier.Control: String. Control type to search for.colName: String. Column hosting the control types. Defaults to "control".
Returns: True when the control type exists on the sheet.
VariableAddress #
Build an Excel address pointing to the variable slot on its sheet
Signature:
Private Function VariableAddress(ByVal varName As String, Optional ByVal onSheet As String = vbNullString) As String
Parameters:
varName: String. Variable identifier.onSheet: Optional String. Sheet where the reference will be consumed; suppresses sheet prefix when matching.
Returns: String Excel address for the variable.
State Validation
EnsureDictionaryReady #
Confirm the backing dictionary and cached range are initialised
Signature:
Private Sub EnsureDictionaryReady(Optional ByVal requirePrepared As Boolean = False)
Parameters:
requirePrepared: Optional Boolean. When True, the dictionary must be prepared.
EnsureSheetExists #
Raise a descriptive error when the sheet does not exist
Signature:
Private Sub EnsureSheetExists(ByVal sheetName As String)
Parameters:
sheetName: String. Sheet identifier to validate.
EnsureSheetRow #
Retrieve the worksheet row for the sheet or raise when absent
Signature:
Private Function EnsureSheetRow(ByVal sheetName As String) As Long
Parameters:
sheetName: String. Sheet identifier.
Returns: Long worksheet row index.
EnsureControlColumnExists #
Guarantee the control column exists before filtering
Signature:
Private Sub EnsureControlColumnExists(ByVal colName As String)
Parameters:
colName: String. Column header to validate.
EnsureValidSheetName #
Validate that the supplied sheet name is usable
Signature:
Private Sub EnsureValidSheetName(ByVal sheetName As String)
Parameters:
sheetName: String. Sheet identifier to validate.
Lookup Helpers
SheetInfoValue #
Resolve sheet metadata based on the selector
Signature:
Private Function SheetInfoValue(ByVal sheetName As String, ByVal infoSelector As Byte) As String
Parameters:
sheetName: String. Sheet identifier.infoSelector: Byte. Selector from LLSheetInfoField.
Returns: String metadata value.
SheetTypeColumnIndex #
Cache the column index for sheet type lookups
Signature:
Private Function SheetTypeColumnIndex() As Long
Returns: Long worksheet column index.
TableNameColumnIndex #
Cache the column index for table name lookups and raise if missing
Signature:
Private Function TableNameColumnIndex() As Long
Returns: Long worksheet column index.
VariablesProvider #
Lazily initialise the LLVariables helper for address resolution
Signature:
Private Function VariablesProvider() As ILLVariables
Returns: ILLVariables cached instance.
ColumnIndex #
Wrapper around IDataSheet.ColumnIndex with optional caching
Signature:
Private Function ColumnIndex(ByVal colName As String, ByVal allowMissing As Boolean) As Long
Parameters:
colName: String. Column header to locate.allowMissing: Boolean. When False, raises when the column is absent.
Returns: Long worksheet column index.
FindSheetCell #
Locate the range corresponding to a sheet name
Signature:
Private Function FindSheetCell(ByVal sheetName As String) As Range
Parameters:
sheetName: String. Sheet identifier (may be empty).
Returns: Range when found; Nothing otherwise.
SanitizeSearchTerm #
Escape Excel wildcard characters before using Range.Find
Signature:
Private Function SanitizeSearchTerm(ByVal value As String) As String
Parameters:
value: String. Raw search term.
Returns: String sanitized search term.
BuildSheetPrefix #
Produce a quoted sheet prefix for addresses
Signature:
Private Function BuildSheetPrefix(ByVal sheetName As String) As String
Parameters:
sheetName: String. Sheet identifier to encode.
Returns: String sheet prefix including trailing exclamation mark.
ResetCaches #
Reset cached lookups following dictionary changes
Signature:
Private Sub ResetCaches()
InvalidateCaches #
Signature:
Public Sub InvalidateCaches()
ValidateDictionary #
Ensure the supplied dictionary exposes the required columns
Signature:
Private Sub ValidateDictionary(ByVal dict As ILLdictionary)
Parameters:
dict: ILLdictionary to validate.
EnsureColumnExists #
Validate that a dictionary column is present
Signature:
Private Sub EnsureColumnExists(ByVal dict As ILLdictionary, ByVal colName As String)
Parameters:
dict: ILLdictionary to inspect.colName: String. Column header to verify.
Error Handling
ThrowError #
Raise a ProjectError-coded runtime error
Signature:
Private Sub ThrowError(ByVal errNumb As Long, ByVal errorMessage As String)
Parameters:
errNumb: ProjectError enumeration value.errorMessage: String human readable description.