MasterSetupPreparation

Internal members (not exported)

Factory helpers

Create #

Signature:

Public Function Create(ByVal hostBook As Workbook) As MasterSetupPreparation

("Create a configured MasterSetupPreparation instance for the supplied workbook.")


Public API

Configure #

Signature:

Public Sub Configure(ByVal hostBook As Workbook)

("Bind the preparation helper to the workbook hosting master setup assets.")


Prepare #

Signature:

Public Sub Prepare(Optional ByVal excelApplication As Application)

("Run the preparation workflow: register dropdowns then initialise the variables table.")


EnsureDropdowns #

Signature:

Public Sub EnsureDropdowns()

("Ensure the dropdown worksheet hosts all required dropdown lists.")


EnsureReportSheet #

Signature:

Public Sub EnsureReportSheet()

("Grow the __compRep report sheet, very hidden, when the workbook lacks it.") An existing sheet keeps its visibility: the Compare button shows it and the user may be reading it. A workbook whose structure is protected refuses the add; that raise is scoped, so the preparation still finishes and the Compare button says the sheet is missing.


EnsureVariables #

Signature:

Public Sub EnsureVariables()

("Ensure the variables worksheet exposes an initialised manager with validations applied.")


EnsureUpdatedRegistry #

Signature:

Public Sub EnsureUpdatedRegistry()

("Rebuild the _updated registry from the tagged columns of the Variables and Choices sheets.") The registry is dropped and built again, the way SetupPreparation.ResetUpdatedRegistry does it: every registry table goes, the watched sheets are read for the tags above their headers (watch for update, translate as text, translate as formula), one registry row and one RNG workbook name are written per tagged column, and every flag is set back to yes. The Update Translations button reads those rows. A watched sheet the workbook lacks is skipped: a fresh file has its Variables table from EnsureVariables and may carry no Choices sheet yet.


Dropdowns #

Signature:

Public Property Get Dropdowns() As DropdownLists

("Expose the dropdown manager for callers needing direct access.")


Variables #

Signature:

Public Property Get Variables() As MasterSetupVariables

("Expose the variables manager associated with the master setup table.")


HostWorkbook #

Signature:

Public Property Get HostWorkbook() As Workbook

("Expose the configured host workbook.")


Preparation helpers

ResetCaches #

Signature:

Private Sub ResetCaches()

("Reset cached dependencies after reconfiguration.")


EnsureUpdatedValuesWatcher #

Signature:

Private Function EnsureUpdatedValuesWatcher() As UpdatedValues

("Bind the updated values watcher to the registry sheet, growing the sheet hidden when it is missing.") An existing registry sheet keeps its visibility; Deploy makes it very hidden later.


EnsureDropdownManager #

Signature:

Private Function EnsureDropdownManager() As DropdownLists

("Ensure the dropdown manager is initialised and cached.")


EnsureVariablesManager #

Signature:

Private Function EnsureVariablesManager() As MasterSetupVariables

("Ensure the variables manager is initialised over an existing listobject.")


EnsureDropdownSheet #

Signature:

Private Function EnsureDropdownSheet() As Worksheet

("Ensure the dropdown worksheet exists and cache the reference.")


EnsureVariablesSheet #

Signature:

Private Function EnsureVariablesSheet() As Worksheet

("Ensure the variables worksheet exists and cache the reference.")


EnsureVariablesTable #

Signature:

Private Function EnsureVariablesTable() As ListObject

("Ensure a variables table exists on the variables worksheet.")


ResolveVariablesTable #

Signature:

Private Function ResolveVariablesTable(ByVal wsVars As Worksheet) As ListObject

("Resolve the primary variables table if it already exists.")


CreateVariablesTable #

Signature:

Private Function CreateVariablesTable(ByVal wsVars As Worksheet) As ListObject

("Create a variables table with default headers when none exists.")


EnsureTableHasRow #

Signature:

Private Sub EnsureTableHasRow(ByVal table As ListObject)

("Ensure the supplied table exposes at least one data row.")


ApplyTableStyle #

Signature:

Private Sub ApplyTableStyle(ByVal table As ListObject, ByVal tableStyle As String)

("Apply a table style while ignoring styling errors on unsupported versions.") Called on a freshly created table only: the style of a table the workbook already carries is the owner's to set.


DefaultVariableHeaders #

Signature:

Private Function DefaultVariableHeaders() As Variant

("Return the default header labels for a freshly created variables table.")


DefaultDropdownDefinitions #

Signature:

Private Function DefaultDropdownDefinitions() As Variant

("Supply the default dropdown definitions required by master setup.")


DefaultDiseaseExclusions #

Signature:

Private Function DefaultDiseaseExclusions() As Variant

("Return the default list of worksheets excluded from disease dropdowns.")


DefaultConfigSheets #

Signature:

Private Function DefaultConfigSheets() As Variant

("Return the default configuration worksheets list.")


RefreshChoicesDropdown #

Signature:

Private Sub RefreshChoicesDropdown(ByVal drop As DropdownLists)

("Populate the choices dropdown from the list names of the Choices sheet.")


RefreshDiseasesDropdown #

Signature:

Private Sub RefreshDiseasesDropdown(ByVal drop As DropdownLists)

("Rebuild the diseases dropdown from the marker sheets of the workbook.")


ThrowError #

Signature:

Private Sub ThrowError(ByVal errNumber As ProjectError, ByVal errMessage As String)

("Centralised error raising aligned with ProjectError codes.")


AdoptLegacyDiseaseSheets #

Signature:

Private Sub AdoptLegacyDiseaseSheets()

("Adopt legacy disease sheets: their cell tags move into hidden names.")


LegacyIndexOf #

Signature:

Private Function LegacyIndexOf(ByVal codeValue As String) As Long

("Parse the numeric index off a legacy disease code.")


SheetCarriesDiseaseTag #

Signature:

Private Function SheetCarriesDiseaseTag(ByVal targetSheet As Worksheet) As Boolean

("Answer whether a worksheet carries the hidden disease tag.")


EnsureDropdownDefinition #

Signature:

Private Sub EnsureDropdownDefinition(ByVal drop As DropdownLists, _
                                     ByVal listName As String, _
                                     ByVal items As Variant)

("Ensure a dropdown definition exists with the supplied values.")


RefreshLanguageDropdowns #

Signature:

Private Sub RefreshLanguageDropdowns(ByVal drop As DropdownLists)

("Populate the languages dropdowns using the translations sheet headers.")


BuildArray #

Signature:

Private Function BuildArray(ByVal items As Variant) As BetterArray

("Convert supplied items into a BetterArray helper.")


EnsureDropdownHasValues #

Signature:

Private Sub EnsureDropdownHasValues(ByVal drop As DropdownLists, _
                                    ByVal listName As String, _
                                    ByVal values As BetterArray)

("Ensure a dropdown either exists or is updated with the supplied values.")


EnsureWorkbookFlags #

Signature:

Private Sub EnsureWorkbookFlags()

("Seed the workbook-level flags of the master setup.")

Seeds the silence switch, OBT__SILENT_OPERATIONS, with "No". "No" means the master setup shows every message box it has always shown, so a person pressing buttons sees no change at all. The name and both values are read off Messenger, which is the one place that string is written on the VBA side.

EnsureName leaves a name that is already there alone, so a second Prepare on a master setup someone switched to "Yes" keeps that value.

THE R PACKAGE DOES NOT DRIVE THIS WORKBOOK TODAY. The entry-point plan names three workbooks and seven operations, and none of them is on the master setup. The flag is seeded here anyway so the fourth workbook is not the one that was forgotten when an operation is added to it: the 48 message boxes of EventsMasterSetupRibbon and MasterSetupExports then have a switch to read, and no caller has to go and create it first.


EnsureVariableNameColumnName #

Signature:

Private Sub EnsureVariableNameColumnName(ByVal manager As MasterSetupVariables)

("Publish the Variable Name column range as a hidden workbook name for downstream formulas.")


ResolveWorksheet #

Signature:

Private Function ResolveWorksheet(ByVal sheetName As String) As Worksheet

("Resolve a worksheet by name without creating it.")


ResolveOrCreateWorksheet #

Signature:

Private Function ResolveOrCreateWorksheet(ByVal sheetName As String, _
                                          Optional ByVal visibility As XlSheetVisibility = xlSheetVisible, _
                                          Optional ByVal applyVisibility As Boolean = True) As Worksheet

("Resolve a worksheet or create it when absent.")


EnsureWorkbook #

Signature:

Private Function EnsureWorkbook() As Workbook

("Ensure the host workbook reference is available.")


Used in (6 file(s))