IDevelopment

Defines the public contract for the Development class, exposing methods for managing code tables (classes, modules, forms, tests), bulk importing and exporting VBA components between disk and the host workbook, configuring deployment settings (hidden and protected sheets), and executing the full deployment workflow. Consumers obtain an IDevelopment reference from Development.Create and interact exclusively through this interface.

Depends on: IPasswords

Lifecycle

Initialise #

Bind the development helper to a Dev worksheet and optional code sheet.

Signature:

Public Sub Initialise(ByVal devSheet As Worksheet, Optional ByVal codeSheet As Worksheet)

Bind the development helper to the Dev worksheet and optional code sheet. Validates the devSheet, stores internal references, initialises collections, verifies required named ranges, and restores any previously registered code worksheet. When a codeSheet is provided, it replaces the restored worksheet.

Parameters:

  • devSheet: Worksheet. The worksheet hosting development named ranges.
  • codeSheet: Optional Worksheet. A worksheet to register as the code table host.

Configuration

DevWorksheet #

Development worksheet reference.

Signature:

Public Property Get DevWorksheet() As Worksheet

Properties that expose and control the internal state of the development helper. Returns the Dev worksheet that stores configuration named ranges such as folder paths and counter values. Set during Initialise.

Returns: Worksheet. The development worksheet bound to this instance.


CodeWorksheet #

Worksheet registered to host development tables.

Signature:

Public Property Get CodeWorksheet() As Worksheet

Returns the worksheet currently registered to host development ListObjects. May be Nothing when no code worksheet has been registered, in which case new tables are created on the Dev sheet itself.

Returns: Worksheet. The code worksheet, or Nothing when none is registered.


DisplayPrompts #

Whether confirmation prompts are displayed.

Signature:

Public Property Get DisplayPrompts() As Boolean

Controls whether confirmation dialogs are shown before mutating operations such as importing, exporting, or adding tables. Defaults to True after Initialise. Set to False to suppress prompts during automated workflows.

Returns: Boolean. True when prompts are enabled.


DisplayPrompts #

Set the confirmation prompt toggle.

Signature:

Public Property Let DisplayPrompts(ByVal value As Boolean)

Parameters:

  • value: Boolean. True to enable prompts, False to suppress them.

Worksheet Preparation

AddCodeSheets #

Register an existing worksheet to host future development tables.

Signature:

Public Function AddCodeSheets(ByVal sheetName As String) As Worksheet

Methods for registering code worksheets and creating development tables. Validates that the worksheet exists in the host workbook, shows a confirmation dialog when prompts are enabled, and persists the registration so it survives workbook close/reopen cycles.

Parameters:

  • sheetName: String. Name of the worksheet to register as the code table host.

Returns: Worksheet. The registered worksheet reference, or Nothing when the user declines the confirmation prompt.


AddClassTable #

Create a classes table on the code worksheet.

Signature:

Public Function AddClassTable(Optional ByVal includeTests As Boolean = False) As ListObject

Creates a new ListObject with columns for class names and an interface Yes/No flag. The includeTests parameter switches the table tag between general classes and test classes, controlling the destination folder during code transfers.

Parameters:

  • includeTests: Optional Boolean. When True, creates a test-scoped classes table. Defaults to False.

Returns: ListObject. The newly created table, or Nothing when the user declines the confirmation prompt.


AddModuleTable #

Create a modules table on the code worksheet.

Signature:

Public Function AddModuleTable(Optional ByVal includeTests As Boolean = False) As ListObject

Creates a new ListObject with a single column for module names. The includeTests parameter switches the tag between general modules and test modules, controlling the destination folder during transfers.

Parameters:

  • includeTests: Optional Boolean. When True, creates a test-scoped modules table. Defaults to False.

Returns: ListObject. The newly created table, or Nothing when the user declines the confirmation prompt.


AddFormsTable #

Create a forms mapping table on the code worksheet.

Signature:

Public Function AddFormsTable() As ListObject

Creates a new ListObject with two columns: "modules" and "corresponding form". Entries drive the AddFormsCodes and Deploy workflows, which copy code from a standard module into the code-behind of a UserForm component.

Returns: ListObject. The newly created table, or Nothing when the user declines the confirmation prompt.


AddTestTable #

Create a test modules table on the code worksheet.

Signature:

Public Function AddTestTable() As ListObject

Creates a new ListObject configured for test module entries with a single "modules" column. The table is tagged so that code transfers target the tests folder.

Returns: ListObject. The newly created table, or Nothing when the user declines the confirmation prompt.


Deployment

AddHiddenSheet #

Register a worksheet that should be hidden during deployment.

Signature:

Public Sub AddHiddenSheet(ByVal sheetName As String)

Methods for configuring deployment settings and executing the deployment workflow. Appends the worksheet name to the hidden list. During Deploy, every entry is set to xlSheetVeryHidden.

Parameters:

  • sheetName: String. Name of the worksheet to hide during deployment.

AddProtectedSheet #

Register a worksheet that should be protected during deployment.

Signature:

Public Sub AddProtectedSheet(ByVal sheetName As String, _
                             Optional ByVal allowShapes As Boolean = True, _
                             Optional ByVal allowDeletingRows As Boolean = True)

Adds the worksheet with its permission flags to the protected list. During Deploy, each entry is protected via the IPasswords handler with the recorded allowShapes and allowDeletingRows settings.

Parameters:

  • sheetName: String. Name of the worksheet to protect during deployment.
  • allowShapes: Optional Boolean. When True, shapes remain editable on the protected sheet. Defaults to True.
  • allowDeletingRows: Optional Boolean. When True, row deletion is allowed on the protected sheet. Defaults to True.

ImportAll #

Import all code artefacts from configured folders into the host workbook.

Signature:

Public Sub ImportAll()

Iterates every development ListObject on host worksheets. For each table entry, the corresponding .bas or .cls file is imported from disk into the VBProject, replacing any existing component of the same name.


ExportAll #

Export all code artefacts from the host workbook to configured folders.

Signature:

Public Sub ExportAll()

Iterates every development ListObject on host worksheets. For each table entry, the VBA component is exported from the VBProject to disk, overwriting any existing file.


AddFormsCodes #

Copy code modules into associated UserForm components.

Signature:

Public Sub AddFormsCodes()

Synchronises form modules by copying the code from each source module listed in forms tables into the corresponding UserForm component. After copying, the source module is removed from the VBProject.


Deploy #

Protect and hide registered worksheets, copy forms code, and set the deployment marker.

Signature:

Public Sub Deploy(ByVal passwords As IPasswords, Optional ByVal lockWorkbook As Boolean = False)

Executes the full deployment workflow: applies the default password, synchronises form modules, hides registered hidden sheets, protects registered protected sheets using the IPasswords handler, optionally locks the workbook, hides the code worksheet, installs the debug exit handler, and sets the workbook-level deployment flag to "Yes".

Parameters:

  • passwords: IPasswords. The password handler used to apply protection.
  • lockWorkbook: Optional Boolean. When True, locks the host workbook structure after protecting sheets. Defaults to False.

Status

InDeployment #

Check whether the workbook has already been deployed.

Signature:

Public Function InDeployment() As Boolean

Read-only status query for the deployment state. Reads the workbook-level named range "inDeployment" and returns True when the stored value equals "Yes" (case-insensitive). Returns False when the name does not exist or contains any other value.

Returns: Boolean. True when the deployment flag equals "Yes".