Checking

Stores a collection of diagnostic messages, each tagged with a unique key, a label, and a severity scope (Error, Warning, Info, Note, or Success). Checking objects serve as lightweight log containers that other classes populate during validation or build processes. The entries are stored in three parallel BetterArray tables (keys, labels, scopes). Presentation to a worksheet is handled by the separate CheckingOutput class.

Depends on: BetterArray

Version: 1.0 (2026-02-09)

Factory

create #

Create a Checking instance for logging diagnostic messages

Signature:

Public Function Create(ByVal titleName As String, _
                       Optional ByVal subtitleName As String = vbNullString) As _

Entry point for creating Checking instances. Checking objects are collections of messages tagged with a scope (Error, Warning, Info, Note, or Success) for logging purposes. The entries are stored in three parallel BetterArray tables (keys, labels, scopes). Checkings must have a title identifying the topic. Optionally, a subtitle provides further context. Titles and subtitles are used when printing the messages to a worksheet via CheckingOutput.

Parameters:

  • titleName: String. Title of the checkings topic.
  • subtitleName: Optional String. Subtitle of the checkings. Defaults to vbNullString.

Returns: IChecking. A ready-to-use Checking instance.

Depends on:

  • BetterArray

Elements

name #

Name of the checking object

Signature:

Private Property Get Name() As String

Read-only metadata properties exposed through the interface. Returns the checking title as the object name. Used for identification in output and presentation contexts.

Returns: String. The checking title.


heading #

Title or subtitle of the checking object

Signature:

Private Property Get Heading(Optional ByVal subtitle As Boolean = False) As String

Returns the subtitle when the subtitle flag is True, otherwise returns the title. Used by CheckingOutput for heading display.

Parameters:

  • subtitle: Optional Boolean. When True, returns the subtitle. Defaults to False.

Returns: String. The title or subtitle.


length #

Total number of entries in the checking

Signature:

Private Property Get Length() As Long

Returns the count of diagnostic messages stored in the parallel arrays.

Returns: Long. Number of entries.


Keys

list-of-keys #

Get the list of keys in the checking

Signature:

Private Property Get ListOfKeys() As BetterArray

Key lookup and enumeration. Returns a clone of the internal keys BetterArray. When the keys table is uninitialised, creates an empty BetterArray with LowerBound 1.

Returns: BetterArray. Clone of stored keys.


key-exists #

Test whether a key is present in the checking

Signature:

Private Function KeyExists(ByVal keyName As String) As Boolean

Searches the keys BetterArray for the specified key name. Returns False immediately for empty strings.

Parameters:

  • keyName: String. Key to search for.

Returns: Boolean. True when the key is found.


InputOutput

add #

Add a new entry to the checking

Signature:

Public Sub Add(ByVal keyName As String, ByVal label As String, _
                Optional ByVal scope As Byte = checkingNote)

Adding, retrieving, cloning, and appending diagnostic entries. Adds a key, the corresponding label, and the scope to the checking. Keys must be unique; duplicate keys raise an error. On first call, initialises the three parallel BetterArray tables.

Parameters:

  • keyName: String. Unique identifier for the entry.
  • label: String. Diagnostic message for the entry.
  • scope: Optional Byte. Severity scope (checkingError, checkingWarning, etc.). Defaults to checkingNote.

Throws:

  • ProjectError.ElementShouldNotExists When the key already exists.

value-of #

Retrieve a property of one specific key

Signature:

 Private Property Get ValueOf(ByVal keyName As String, Optional ByVal retrievedValue As Byte = 1) As String

Returns the label, the type descriptor (with icon), or the colour string for the specified key depending on the retrievedValue selector. Raises an error when the key does not exist.

Parameters:

  • keyName: String. Key from which to retrieve values.
  • retrievedValue: Optional Byte. CheckingValue enum selector. Defaults to checkingLabel.

Returns: String. The requested property value.

Throws:

  • ProjectError.ElementShouldExists When the key is not found.

clone #

Produce a deep copy of the current checking entries

Signature:

Private Function Clone() As IChecking

Creates a new Checking instance with the same title, subtitle, and logged entries. Required so that flushing a checking into another container does not keep a live reference to the current object.

Returns: IChecking. Independent clone.


append #

Append entries from another checking to the current one

Signature:

Private Sub Append(ByVal checks As IChecking)

Iterates through the supplied IChecking entries and adds each one to the current checking. Silently exits when the supplied checking is Nothing or empty.

Parameters:

  • checks: IChecking. Source checking to merge from.

Internal members (not exported)

PublicAccessors

self #

Current object instance

Signature:

Public Property Get Self() As IChecking

Properties that expose internal state and the interface pointer. Returns the current instance cast to its interface. Used internally by the factory method to return an IChecking reference.

Returns: IChecking. Reference to the current object.


checking-title #

Title of the checking topic

Signature:

Public Property Get CheckingTitle() As String

Returns the title string assigned during creation or via the setter.

Returns: String. Title of the checkings.


checking-subtitle #

Subtitle of the checking topic

Signature:

Public Property Get CheckingSubTitle() As String

Returns the subtitle string assigned during creation or via the setter.

Returns: String. Subtitle of the checkings.


checking-title-set #

Assign the checking title

Signature:

Public Property Let CheckingTitle(ByVal titleName As String)

Parameters:


checking-subtitle-set #

Assign the checking subtitle

Signature:

Public Property Let CheckingSubTitle(ByVal subtitleName As String)

Parameters:


Helpers

scope-from-type-label #

Convert a type label string back to its CheckingScope byte value

Signature:

Private Function ScopeFromTypeLabel(ByVal typeLabel As String) As Byte

Private utility methods. Parses the human-readable type label (e.g. "Error", "Warning") and returns the corresponding CheckingScope enum value. Defaults to checkingNote when no match is found.

Parameters:

Returns: Byte. CheckingScope value.


ErrorHandling

throw-error #

Raise a VBA error with the class signature

Signature:

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

Centralised error-raising pattern. Wrapper around Err.Raise that standardises the source to CLASSNAME for consistent stack traces.

Parameters:

Throws:


Interface

IChecking_Name #

Signature:

Private Property Get IChecking_Name() As String

Delegated members satisfying the IChecking contract.


Used in (47 file(s))