ImportReport
The store an import report is kept in. It owns four ListObjects on the __import_rep worksheet. ProvisionTables builds the tables, SaveSheets and SaveVariables write the entries, Clear empties them, HasEntries says whether anything was recorded, and SheetNames and VariableEntries read the entries back. The class knows nothing about forms.
THE STORE MAKES ITS OWN TABLES
Create builds any of the four that is absent. A linelist built by the current generation carries all four, and one built by an older generation may carry none.
THE REPORT LIVES ON A WORKSHEET
The report survives the workbook closing, so a user can open the last one from the advanced form days later.
THE FOUR TABLES
reptab_sheetsNotImp a worksheet of the file this linelist has none of reptab_sheetsNotTouch a worksheet of this linelist the file has none of reptab_varsNotImp a variable of the file this linelist has none of reptab_varsNotTouch a variable of this linelist the file has none of
The two variable tables carry the sheet a variable belongs to in a second column. The values stored here are names of worksheets and variables, and they are stored untranslated. The form translates its own labels.
Depends on: BetterArray, LLImporter
Version: 1.0 (2026-08-01)
Factory
Create #
create
Bind to the import report worksheet of a linelist
Signature:
Public Function Create(ByVal wkb As Workbook) As ImportReport
The worksheet is made when the workbook has none, and any of the four tables that is absent is built. The sheet is left very hidden, which is how the generation makes it: the form reads the tables and nobody opens the sheet.
Parameters:
wkb: Workbook. The linelist workbook.
Returns: ImportReport. A ready store.
Throws:
- ProjectError.ObjectNotInitialized When the workbook is Nothing.
Wksh #
wksh
The worksheet the four tables sit on
Signature:
Public Property Get Wksh() As Worksheet
Returns: Worksheet. The store worksheet.
ProvisionTables #
provision-tables
Build any of the four tables the worksheet is missing
Signature:
Public Sub ProvisionTables()
Public because Create calls it on the instance it just made, after sealing. Never activates or selects the sheet: __import_rep is very hidden and activating a very hidden sheet raises.
Writing the report
Clear #
clear
Empty the four tables
Signature:
Public Sub Clear()
Called at the start of every import, so the store always describes the last one rather than every one that ever ran.
SaveSheets #
save-sheets
Write one list of worksheet names into its table
Signature:
Public Sub SaveSheets(ByVal scope As Byte, ByVal sheetsList As BetterArray)
Parameters:
scope: Byte. An ImportReportScope value.sheetsList: BetterArray. The worksheet names.
SaveVariables #
save-variables
Write one list of variables and their sheets into its table
Signature:
Public Sub SaveVariables(ByVal scope As Byte, ByVal varsList As BetterArray)
Parameters:
scope: Byte. An ImportReportScope value.varsList: BetterArray. Entries of Array(variableName, sheetName).
Reading the report back
HasEntries #
has-entries
Whether the store holds anything at all
Signature:
Public Property Get HasEntries() As Boolean
Returns: Boolean. True when at least one of the four tables holds a row.
SheetNames #
sheet-names
The worksheet names one table holds
Signature:
Public Property Get SheetNames(ByVal scope As Byte) As BetterArray
Named SheetNames rather than Sheets, because Sheets is the workbook collection and a member of that name reads as one everywhere it is used.
Parameters:
scope: Byte. An ImportReportScope value.
Returns: BetterArray. The names. Never Nothing.
VariableEntries #
variable-entries
The variables and their sheets one table holds
Signature:
Public Property Get VariableEntries(ByVal scope As Byte) As BetterArray
Parameters:
scope: Byte. An ImportReportScope value.
Returns: BetterArray. Entries of Array(variableName, sheetName). Never Nothing.
Internal members (not exported)
Factory
Wksh #
wksh-set
Assign the worksheet the four tables sit on
Signature:
Public Property Set Wksh(ByVal sh As Worksheet)
Parameters:
sh: Worksheet. The store worksheet.
Seal #
seal
Prevent further changes to setup-only properties
Signature:
Public Sub Seal()
GuardNotSealed #
guard-not-sealed
Raise when a setup-only property is written after sealing
Signature:
Private Sub GuardNotSealed(ByVal propName As String)
Parameters:
propName: String. The name of the property being guarded.
Private - The four tables
SheetTableOf #
sheet-table-of
The worksheet table one scope writes into
Signature:
Private Function SheetTableOf(ByVal scope As Byte) As String
Parameters:
scope: Byte. An ImportReportScope value.
Returns: String. The table name, empty for an unknown scope.
VariableTableOf #
variable-table-of
The variable table one scope writes into
Signature:
Private Function VariableTableOf(ByVal scope As Byte) As String
Parameters:
scope: Byte. An ImportReportScope value.
Returns: String. The table name, empty for an unknown scope.
NamedTable #
named-table
The ListObject of one name, or Nothing
Signature:
Private Function NamedTable(ByVal tableName As String) As ListObject
Parameters:
tableName: String. The table to find.
Returns: ListObject. The table, or Nothing when the sheet carries none.
EnsureTable #
ensure-table
Build one table when the worksheet has none of that name
Signature:
Private Sub EnsureTable(ByVal tableName As String, ByVal startColumn As Long, _
ByVal firstHeader As String, ByVal secondHeader As String)
Parameters:
tableName: String. The table name.startColumn: Long. The column its first header sits in.firstHeader: String. The first header text.secondHeader: String. The second header text, empty for a one-column table.
ClearOneTable #
clear-one-table
Empty one table and take it back to a single blank row
Signature:
Private Sub ClearOneTable(ByVal tableName As String)
Parameters:
tableName: String. The table to empty.
RowCountOf #
row-count-of
How many filled rows one table holds
Signature:
Private Function RowCountOf(ByVal tableName As String) As Long
A table always keeps one data row, which is blank when nothing was written, so the count is taken off the first column rather than off the table height.
Parameters:
tableName: String. The table to measure.
Returns: Long. The number of filled rows.
WriteOneColumn #
write-one-column
Write a list of names into a one-column table
Signature:
Private Sub WriteOneColumn(ByVal tableName As String, ByVal valuesList As BetterArray)
Parameters:
tableName: String. The table to write into.valuesList: BetterArray. The names.
WriteTwoColumns #
write-two-columns
Write a list of variable and sheet pairs into a two-column table
Signature:
Private Sub WriteTwoColumns(ByVal tableName As String, ByVal valuesList As BetterArray)
Parameters:
tableName: String. The table to write into.valuesList: BetterArray. Entries of Array(variableName, sheetName).
ReadOneColumn #
read-one-column
Read the filled rows of a one-column table
Signature:
Private Function ReadOneColumn(ByVal tableName As String) As BetterArray
Parameters:
tableName: String. The table to read.
Returns: BetterArray. The names. Never Nothing.
ReadTwoColumns #
read-two-columns
Read the filled rows of a two-column table
Signature:
Private Function ReadTwoColumns(ByVal tableName As String) As BetterArray
Parameters:
tableName: String. The table to read.
Returns: BetterArray. Entries of Array(variableName, sheetName). Never Nothing.
Private - Error Handling
ThrowError #
throw-error
Raise a class level error
Signature:
Private Sub ThrowError(ByVal errNumber As ProjectError, ByVal message As String)
Parameters:
errNumber: ProjectError. The error to raise.message: String. What went wrong, for a person reading it.
Throws:
- ProjectError Always raises.
Used in (5 file(s))
- LLImporter.cls
- Linelist.cls
- FormLogicImportRep.bas
- TestImportReport.bas
- TestLLImporter.bas