LLSheets

Factory

Create #

Instantiate a sheet helper bound to the supplied dictionary

Signature:

Public Function Create(ByVal dict As LLdictionary) As LLSheets

Parameters:

  • dict: LLdictionary providing sheet metadata.

Returns: LLSheets fully initialised helper.


Internal members (not exported)

Public Accessors

Dictionary #

Retrieve the backing dictionary

Signature:

Public Property Get Dictionary() As LLdictionary

Returns: LLdictionary reference captured during initialisation.


Dictionary #

Store the backing dictionary and prime cached lookups

Signature:

Public Property Set Dictionary(ByVal dict As LLdictionary)

Parameters:


Seal #

Prevent further changes to creation-only setters

Signature:

Public Sub Seal()

GuardNotSealed #

Guard creation-only setters after sealing

Signature:

Private Sub GuardNotSealed(ByVal propName As String)

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:

Public Function Contains(ByVal sheetName As String) As Boolean

Parameters:

Returns: True when the sheet exists.


RowIndex #

Lookup the worksheet row hosting the sheet metadata

Signature:

Public Function RowIndex(ByVal sheetName As String) As Long

Parameters:

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:

Returns: Requested metadata value; raises when selector is unknown.


Varlist #

VarList

Retrieve the ordered list of variables belonging to a sheet

Signature:

Private Function Varlist(ByVal sheetName As String) As BetterArray

Parameters:

Returns: BetterArray containing variable names for the sheet.


NumberOfVars #

NumberVars

Count the variables associated with a sheet

Signature:

Public Function NumberOfVars(ByVal sheetName As String) As Long

Parameters:

Returns: Long number of variables present on the sheet.


DataBounds #

Compute the data boundaries for a sheet layout

Signature:

Public Function DataBounds(ByVal sheetName As String, _
                            Optional ByVal Bound As Byte = SheetBound.RowSart) As Long

Parameters:

Returns: Long representing the requested bound.


ContainsControl #

Test whether a sheet exposes a control of the requested type

Signature:

Public Function ContainsControl(ByVal sheetName As String, _
                                 Optional ByVal Control As String = "list_auto", _
                                 Optional ByVal colName As String = COL_CONTROL) As Boolean

Parameters:

Returns: True when the control type exists on the sheet.


VariableAddress #

Build an Excel address pointing to the variable slot on its sheet

Signature:

Public Function VariableAddress(ByVal varName As String, Optional ByVal onSheet As String = vbNullString) As String

Parameters:

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:


EnsureSheetExists #

Raise a descriptive error when the sheet does not exist

Signature:

Private Sub EnsureSheetExists(ByVal sheetName As String)

Parameters:


EnsureSheetRow #

Retrieve the worksheet row for the sheet or raise when absent

Signature:

Private Function EnsureSheetRow(ByVal sheetName As String) As Long

Parameters:

Returns: Long worksheet row index.


EnsureControlColumnExists #

Guarantee the control column exists before filtering

Signature:

Private Sub EnsureControlColumnExists(ByVal colName As String)

Parameters:


EnsureValidSheetName #

Validate that the supplied sheet name is usable

Signature:

Private Sub EnsureValidSheetName(ByVal sheetName As String)

Parameters:


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:

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 LLVariables

Returns: LLVariables cached instance.


ColumnIndex #

Wrapper around DataSheet.ColumnIndex with optional caching

Signature:

Private Function ColumnIndex(ByVal colName As String, ByVal allowMissing As Boolean) As Long

Parameters:

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:

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:

Returns: String sanitized search term.


BuildSheetPrefix #

Produce a quoted sheet prefix for addresses

Signature:

Private Function BuildSheetPrefix(ByVal sheetName As String) As String

Parameters:

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 LLdictionary)

Parameters:


EnsureColumnExists #

Validate that a dictionary column is present

Signature:

Private Sub EnsureColumnExists(ByVal dict As LLdictionary, ByVal colName As String)

Parameters:


Error Handling

ThrowError #

Raise a ProjectError-coded runtime error

Signature:

Private Sub ThrowError(ByVal errNumb As Long, ByVal errorMessage As String)

Parameters:


Used in (9 file(s))