Skip to content

xlflow module

Create, remove, rename, or install VBA module source files in an existing project.

Usage

bash
xlflow module new <name> --type standard
xlflow module new <name> --type class
xlflow module remove <module-name>
xlflow module rename <old-name> <new-name>
xlflow module install [--push]

Options and Arguments

Option / argumentDescriptionDefault
new <name>Create a new standard or class module source file.-
--typeRequired for new; must be standard or class.required
remove <module-name>Remove a standard, class, or UserForm source module from the project.-
rename <old-name> <new-name>Rename a standard, class, or UserForm source module in the project.-
installInstall the bundled helper modules into the configured module source root.required
--pushPush the installed helper modules into the configured workbook after writing source files.false

Examples

bash
xlflow module new InvoiceProcessor --type standard
xlflow module new InvoiceService --type class --json
xlflow module remove InvoiceAggregator
xlflow module rename OldInvoiceService InvoiceService --json
xlflow module install
xlflow module install --push --json

Notes

TIP

module new --type standard writes [src].modules/<Name>.bas; module new --type class writes [src].classes/<Name>.cls.

TIP

module install writes XlflowAssert.bas, XlflowRuntime.bas, XlflowUI.bas, and XlflowDebug.bas into the configured [src].modules/Xlflow/ directory. It refuses both target collisions and legacy root-level helper collisions.

WARNING

module new and module install refuse to overwrite existing source files. Remove or rename colliding files before retrying.

WARNING

module remove and module rename change source files only. Run xlflow push afterward to apply the change to the workbook.

TIP

UserForm remove/rename handles related source artifacts together: .frm, .frx, src/forms/code/<Name>.bas, and src/forms/specs/<Name>.yaml|yml|json when present.

WARNING

Workbook document modules such as ThisWorkbook and sheet modules are protected from module remove and module rename.

JSON Output Example

Successful --json output uses the xlflow envelope plus command-specific fields.

json
{
  "status": "ok",
  "command": "module new",
  "source": {
    "created": ["src/modules/InvoiceProcessor.bas"],
    "kind": "standard",
    "name": "InvoiceProcessor",
    "path": "src/modules/InvoiceProcessor.bas"
  }
}
json
{
  "status": "ok",
  "command": "module remove",
  "source": {
    "operation": "module.remove",
    "module": "InvoiceAggregator",
    "kind": "standard",
    "removed": ["src/modules/InvoiceAggregator.bas"],
    "requires_push": true
  }
}
json
{
  "status": "ok",
  "command": "module rename",
  "source": {
    "operation": "module.rename",
    "old_name": "OldInvoiceService",
    "new_name": "InvoiceService",
    "kind": "class",
    "renamed": [
      {
        "from": "src/classes/OldInvoiceService.cls",
        "to": "src/classes/InvoiceService.cls"
      }
    ],
    "requires_push": true
  }
}
json
{
  "status": "ok",
  "command": "module install",
  "source": {
    "created": [
      "src/modules/Xlflow/XlflowAssert.bas",
      "src/modules/Xlflow/XlflowRuntime.bas",
      "src/modules/Xlflow/XlflowUI.bas",
      "src/modules/Xlflow/XlflowDebug.bas"
    ]
  }
}

Released under the MIT License.