LLExporter
Exports linelist data into standalone workbooks for distribution. Supports four export modes: custom filtered exports (ExportCustom), full migration exports (ExportMigration), analysis-only exports (ExportAnalysis), and geobase exports (ExportGeo). Each mode builds a temporary output workbook, populates it with the relevant data, metadata, and formatting, then saves and closes it. Consumers interact through the ILLExporter interface.
Depends on: ILLdictionary, ILLExport, IPasswords, ICustomTable, IDataSheet, IShowHideManager, IAnaTabIds, ILLGeo, ILLChoices, IHiddenNames
Factory
create #
Create an exporter from the source linelist workbook
Signature:
Public Function Create(ByVal sourceWkb As Workbook) As ILLExporter
Factory method that validates the workbook is not Nothing, then constructs and returns a new LLExporter instance through the ILLExporter interface. Called on the predeclared instance.
Parameters:
sourceWkb: Workbook. The linelist workbook containing the data to export.
Returns: ILLExporter. A fully initialised instance ready for export operations.
Throws:
- ProjectError.ObjectNotInitialized When the workbook is Nothing.
Public Accessors
last-export-password #
Password used in the last export operation
Signature:
Public Property Get LastExportPassword() As String
Returns the password applied to the most recent custom export, or an empty string when no password was used. Modules display this value to the user after a successful export so they can share it securely.
Returns: String. The password, or vbNullString.
Export Methods
export-custom #
Export a numbered custom export definition
Signature:
Public Function ExportCustom(ByVal exportNumber As Long, _
ByVal folderPath As String, _
Optional ByVal useFilters As Boolean = False) As String
Creates an output workbook containing filtered data, optional metadata sheets, and optional analysis sheets according to the export definition identified by exportNumber on the Exports sheet. Removes p-codes and personal identifiers if configured, prepares a temp dictionary, sorts it, then populates the output workbook with data sheets and formatting. Saves the workbook with an optional password and returns the file path.
Parameters:
exportNumber: Long. Which export definition to use (1-based).folderPath: String. Target folder for the saved file.useFilters: Optional Boolean. When True, exports filtered HList data. Defaults to False.
Returns: String. Saved file path, or vbNullString on failure.
export-migration #
Export all data for migration to another linelist
Signature:
Public Function ExportMigration(ByVal folderPath As String, _
Optional ByVal includeShowHide As Boolean = False, _
Optional ByVal keepLabels As Boolean = False) As String
Creates an output workbook with full unfiltered data, metadata sheets, dictionary, choices, translations, and metadata tags for re-import. Optionally includes show/hide state with column widths. No password is applied. Returns the saved file path.
Parameters:
folderPath: String. Target folder for the saved file.includeShowHide: Optional Boolean. When True, includes show/hide state. Defaults to False.keepLabels: Optional Boolean. When True, marks editable labels for update on import. Defaults to False.
Returns: String. Saved file path, or vbNullString on failure.
export-analysis #
Export analysis worksheets only
Signature:
Public Function ExportAnalysis(ByVal folderPath As String) As String
Creates an output workbook containing only the four analysis sheets (univariate, time series, spatial, spatio-temporal) with their values, formatting, and graphs. No data or metadata sheets are included. Saves as xlsx without password.
Parameters:
folderPath: String. Target folder for the saved file.
Returns: String. Saved file path, or vbNullString on failure.
export-geo #
Export geobase data to a separate workbook
Signature:
Public Function ExportGeo(ByVal folderPath As String, _
Optional ByVal onlyHistoric As Boolean = False) As String
Creates an output workbook and delegates to LLGeo.ExportToFile to write the geobase data. When onlyHistoric is True, exports only the historic subset. The file name includes a date stamp and optionally a "_historic" suffix.
Parameters:
folderPath: String. Target folder for the saved file.onlyHistoric: Optional Boolean. When True, exports only the historic geobase. Defaults to False.
Returns: String. Saved file path, or vbNullString on failure.
close-all #
Close all output workbooks that may still be open
Signature:
Public Sub CloseAll()
Closes any output workbook left open after an export error, preventing orphaned minimized windows. Safe to call even when no workbook is open.
Internal members (not exported)
Public Accessors
self #
Current object instance
Signature:
Public Property Get Self() As ILLExporter
Returns: ILLExporter. The current instance cast to the interface.
source-workbook #
Source linelist workbook
Signature:
Public Property Get SourceWorkbook() As Workbook
Returns: Workbook. The linelist workbook bound to this exporter.
source-workbook-set #
Assign the source linelist workbook
Signature:
Public Property Set SourceWorkbook(ByVal wb As Workbook)
Parameters:
wb: Workbook. The workbook to store.
Private - Source Object Accessors
source-dictionary #
Get a dictionary from the source workbook
Signature:
Private Function SourceDictionary(ByVal nbExp As Long) As ILLdictionary
Parameters:
nbExp: Long. Number of export columns to configure.
Returns: ILLdictionary. Dictionary instance from the Dictionary sheet.
export-object #
Get the export configuration from the source workbook
Signature:
Private Function ExportObject() As ILLExport
Returns: ILLExport. Export configuration from the Exports sheet.
passwords-object #
Get passwords from the source workbook
Signature:
Private Function PasswordsObject() As IPasswords
Returns: IPasswords. Passwords instance from the __pass sheet.
geo-object #
Get the geo object from the source workbook
Signature:
Private Function GeoObject() As ILLGeo
Returns: ILLGeo. Geo instance from the Geo sheet.
Private - Output Workbook Management
create-output-workbook #
Create a new minimized output workbook
Signature:
Private Function CreateOutputWorkbook() As Workbook
Returns: Workbook. The newly created workbook.
save-workbook #
Save and close the output workbook
Signature:
Private Sub SaveWorkbook(ByVal outwb As Workbook, ByVal filePath As String, _
ByVal fileFormat As Long, ByVal password As String)
Saves the workbook to the specified path with the given format and optional password, then closes it without saving again.
Parameters:
outwb: Workbook. The workbook to save.filePath: String. Full path including file name and extension.fileFormat: Long. Excel file format constant (xlOpenXMLWorkbook or xlExcel12).password: String. Password to apply, or vbNullString for none.
build-file-path #
Build a full file path from folder, name, and extension
Signature:
Private Function BuildFilePath(ByVal folderPath As String, ByVal fileName As String, _
ByVal fileExt As String) As String
Parameters:
folderPath: String. Target folder path.fileName: String. File name without extension.fileExt: String. File extension without dot.
Returns: String. The assembled file path.
Private - Dictionary Preparation
remove-pcodes #
Remove p-codes variables from a custom export if configured
Signature:
Private Sub RemovePCodes(ByVal dict As ILLdictionary, ByVal expObj As ILLExport, _
ByVal exportNumber As Long, ByVal expName As String)
Checks the export configuration for "include p-codes". When set to "no", clears the export column cells for all dictionary rows whose main label matches a geo p-code or geo concat tag.
Parameters:
dict: ILLdictionary. The source dictionary.expObj: ILLExport. The export configuration.exportNumber: Long. Which export definition to check.expName: String. The export column name (e.g. "export 1").
remove-personal-identifiers #
Remove personal identifiers from a custom export if configured
Signature:
Private Sub RemovePersonalIdentifiers(ByVal dict As ILLdictionary, ByVal expObj As ILLExport, _
ByVal exportNumber As Long, ByVal expName As String)
Checks the export configuration for "include personal identifiers". When set to "no", clears the export column cells for all dictionary rows flagged as personal identifiers.
Parameters:
dict: ILLdictionary. The source dictionary.expObj: ILLExport. The export configuration.exportNumber: Long. Which export definition to check.expName: String. The export column name.
prepare-temp-dictionary #
Write dictionary data to the temp sheet for export processing
Signature:
Private Sub PrepareTempDictionary(ByVal dict As ILLdictionary, _
ByVal expName As String, _
ByVal fullExport As Boolean)
When fullExport is True, copies the entire dictionary. When False, filters on the export column name to include only rows assigned to that export. Writes the result to the temp__ sheet and adds a blue font tag to mark the dictionary as prepared.
Parameters:
dict: ILLdictionary. The source dictionary.expName: String. The export column name to filter on, or vbNullString for full.fullExport: Boolean. When True, copies the entire dictionary unfiltered.
export-dictionary-from-temp #
Create an export dictionary from the temp sheet
Signature:
Private Function ExportDictionaryFromTemp(ByVal nbExp As Long) As ILLdictionary
Parameters:
nbExp: Long. Number of export columns.
Returns: ILLdictionary. Dictionary built from the temp__ sheet.
sort-export-dictionary #
Sort the export dictionary by table name and export column
Signature:
Private Sub SortExportDictionary(ByVal expDict As ILLdictionary, ByVal expName As String)
Parameters:
expDict: ILLdictionary. The dictionary to sort.expName: String. The export column name to use as secondary sort key.
Private - Metadata and Sheets
add-metadata-sheets #
Add Metadata, Choices, and Translations sheets to the output workbook
Signature:
Private Sub AddMetadataSheets(ByVal outwb As Workbook, ByVal dict As ILLdictionary, _
ByVal nbExp As Long)
Parameters:
outwb: Workbook. The output workbook.dict: ILLdictionary. The source dictionary.nbExp: Long. Number of export columns.
add-dictionary #
Add the dictionary to the output workbook
Signature:
Private Sub AddDictionary(ByVal outwb As Workbook, ByVal dict As ILLdictionary, _
ByVal nbExp As Long, ByVal exportColumn As String)
Exports the dictionary filtered by exportColumn, then marks the output dictionary as prepared with a blue font tag.
Parameters:
outwb: Workbook. The output workbook.dict: ILLdictionary. The source dictionary.nbExp: Long. Number of export columns.exportColumn: String. The export column to filter on, or "all".
add-custom-dropdowns #
Add custom dropdowns to the Choices sheet in the output workbook
Signature:
Private Sub AddCustomDropdowns(ByVal outwb As Workbook)
Reads custom dropdown ListObjects from the source workbook custom dropdown sheet and adds each one to the output Choices sheet. Silently exits when no custom dropdown sheet exists.
Parameters:
outwb: Workbook. The output workbook.
add-metadata-tags #
Add metadata tags to the Metadata sheet in the output workbook
Signature:
Private Sub AddMetadataTags(ByVal outwb As Workbook, ByVal scope As Byte, _
ByVal exportNumber As Long, _
ByVal includeShowHide As Boolean, _
ByVal keepLabels As Boolean)
Appends export_type, export_date, editable_labels, show_hide, and epiweekstart tags to the Metadata sheet variable/value table. These tags control import behaviour when the exported file is re-imported.
Parameters:
outwb: Workbook. The output workbook.scope: Byte. ExportScope value (ExportScopeCustom or ExportScopeMigration).exportNumber: Long. The export number for custom exports.includeShowHide: Boolean. When True, tags show_hide as "update on import".keepLabels: Boolean. When True, tags editable_labels as "update on import".
add-show-hide #
Export show/hide state with column widths to the output workbook
Signature:
Private Sub AddShowHide(ByVal outwb As Workbook)
Creates a show_hide__ sheet in the output workbook with a ListObject containing layer, field_key, header_text, hidden_flag, and column_width columns. For each data sheet, creates a ShowHideManager per applicable layer (HList, Printed, VList) and exports the current visibility state.
Parameters:
outwb: Workbook. The output workbook.
import-current-show-hide #
Import current user overrides from the show_hide__ ListObject
Signature:
Private Sub ImportCurrentShowHide(ByVal shm As IShowHideManager)
Reads the show_hide__ sheet from the source workbook and imports the user visibility plan into the ShowHideManager, ensuring the exported show/hide reflects the user actual choices.
Parameters:
shm: IShowHideManager. The manager to populate.
add-analysis-sheets #
Add analysis worksheets to the output workbook
Signature:
Private Sub AddAnalysisSheets(ByVal outwb As Workbook, ByVal afterSheetName As String)
Copies values and formats from the four analysis sheets (univariate, time series, spatial, spatio-temporal) in the source workbook to new sheets in the output workbook. Removes gridlines and writes graph objects via AnaTabIds.
Parameters:
outwb: Workbook. The output workbook.afterSheetName: String. Name of the sheet to insert after.
Private - Data Export
add-data-sheets #
Add data to each output sheet from source HList/VList worksheets
Signature:
Private Sub AddDataSheets(ByVal outwb As Workbook, ByVal expDict As ILLdictionary, _
ByVal useLabels As Boolean, ByVal startLine As Long, _
ByVal useFilters As Boolean)
Iterates over the unique sheet names in the export dictionary, reads data from the corresponding source sheet, and writes it to the output sheet. For HList sheets, delegates to CustomTable.Export. For VList sheets, delegates to ExportVListData. Applies formatting to each output sheet.
Parameters:
outwb: Workbook. The output workbook.expDict: ILLdictionary. The export dictionary with variable assignments.useLabels: Boolean. When True, writes label row above data headers.startLine: Long. Data start row (2 when labels are on row 1).useFilters: Boolean. When True, reads from filtered companion sheets.
export-vlist-data #
Export VList data (variable/value pairs) to the output sheet
Signature:
Private Sub ExportVListData(ByVal inpsh As Worksheet, ByVal outsh As Worksheet, _
ByVal headersList As BetterArray, _
ByVal useLabels As Boolean, ByVal startLine As Long)
Writes variable names and their values as rows. When useLabels is True, replaces variable names with their labels.
Parameters:
inpsh: Worksheet. The source VList worksheet.outsh: Worksheet. The output worksheet.headersList: BetterArray. Variable names to export.useLabels: Boolean. When True, writes labels instead of variable names.startLine: Long. Column offset for data start.
Private - Formatting Helpers
format-output-sheet #
Apply standard formatting to an output data sheet
Signature:
Private Sub FormatOutputSheet(ByVal outsh As Worksheet)
Sets row heights, column widths, font, header styling, and auto-fits columns. Wrapped in error handling to prevent failures on protected or special sheets.
Parameters:
outsh: Worksheet. The worksheet to format.
remove-gridlines #
Remove gridlines from an analysis output sheet
Signature:
Private Sub RemoveGridLines(ByVal sh As Worksheet)
Parameters:
sh: Worksheet. The worksheet to update.
Private - Error Handling
throw-error #
Raise a ProjectError-based exception
Signature:
Private Sub ThrowError(ByVal errNumber As ProjectError, ByVal message As String)
Wrapper around Err.Raise that standardises the source to CLASS_NAME.
Parameters:
errNumber: ProjectError. The error code to raise.message: String. Human-readable description of the failure.
Throws:
- ProjectError.
Always raises the specified error.
Interface Implementation
ILLExporter_ExportCustom #
Signature:
Private Function ILLExporter_ExportCustom(ByVal exportNumber As Long, _
ByVal folderPath As String, _
Optional ByVal useFilters As Boolean = False) As String
Delegated members satisfying the ILLExporter contract. See the corresponding members above for full documentation.