DesignerImportService
Orchestrates importing setup components (dictionary, choices, analysis, exports, formatter, translations) from a setup workbook into the designer workbook, and exporting components (dictionary, choices, analysis, exports, geo, passwords) to a linelist workbook. After ExportToLinelist, new domain manager instances targeting the exported workbook are available via accessor properties. This class is designed to replace the import/export step in LinelistSpecs in the long run.
Depends on: LLdictionary, LLChoices, LLExport, Analysis, LLGeo, Passwords, LLFormat, LLTranslation, HiddenNames
Factory
create #
Create and configure a designer import service
Signature:
Public Function Create(Optional ByVal hostBook As Workbook = Nothing) As IDesignerImportService
Factory method that creates a new DesignerImportService instance, binds it to the supplied designer workbook, and returns the result through the IDesignerImportService interface. When no workbook is provided, defaults to ThisWorkbook.
Parameters:
hostBook: Optional Workbook. The designer workbook. Defaults to ThisWorkbook.
Returns: IDesignerImportService. A configured instance ready for use.
Public API
configure #
Bind the service to the designer workbook
Signature:
Public Sub Configure(ByVal hostBook As Workbook)
Parameters:
hostBook: Workbook. The designer workbook to operate on.
Throws:
- ProjectError.ObjectNotInitialized When the workbook is Nothing.
host-workbook #
The configured host workbook
Signature:
Public Property Get HostWorkbook() As Workbook
Returns: Workbook. The host workbook.
Throws:
- ProjectError.ObjectNotInitialized When the workbook was not configured.
import-from-setup #
Import setup components into the host workbook
Signature:
Public Sub ImportFromSetup(ByVal setupPath As String)
Opens the setup workbook at the supplied path (read-only), then imports each component by creating domain managers from the setup workbook and exporting their data into the host workbook. Translations are imported via LLTranslation.ImportDictionary. The setup workbook is always closed on exit, even when errors occur.
Parameters:
setupPath: String. Full path to the setup workbook.
Throws:
- ProjectError.SomethingWentWrong When the setup workbook cannot be opened or import fails.
export-to-linelist #
Export designer components to a linelist workbook
Signature:
Public Sub ExportToLinelist(ByVal targetBook As Workbook)
Exports dictionary, choices, analysis, exports, geo, and passwords from the host workbook into the provided target workbook. The target workbook is NOT closed. After export, new domain manager instances targeting the exported workbook are stored on the service and accessible via Exported* properties. Any error during export is re-raised after cleanup.
Parameters:
targetBook: Workbook. The linelist workbook to receive exported data.
Throws:
- ProjectError.ObjectNotInitialized When targetBook is Nothing.
- ProjectError.SomethingWentWrong When export fails.
Internal members (not exported)
Factory
self #
Current object instance
Signature:
Public Property Get Self() As IDesignerImportService
Returns: IDesignerImportService. The current instance cast to the interface.
Exported Instance Properties
exported-dictionary #
Signature:
Public Property Get ExportedDictionary() As ILLdictionary
exported-choices #
Signature:
Public Property Get ExportedChoices() As ILLChoices
exported-analysis #
Signature:
Public Property Get ExportedAnalysis() As IAnalysis
exported-export #
Signature:
Public Property Get ExportedExport() As ILLExport
exported-geo #
Signature:
Public Property Get ExportedGeo() As ILLGeo
exported-passwords #
Signature:
Public Property Get ExportedPasswords() As IPasswords
exported-translations #
Signature:
Public Property Get ExportedTranslations() As ILLTranslation
Import Helpers (Setup -> Designer)
import-dictionary #
Export dictionary from setup into the host workbook
Signature:
Private Sub ImportDictionary(ByVal setupBook As Workbook, ByVal hostBook As Workbook)
The data start row depends on the setup file format: .xlsb files have metadata rows above the data (row 5), while .xlsx files start at row 1.
import-choices #
Export choices from setup into the host workbook
Signature:
Private Sub ImportChoices(ByVal setupBook As Workbook, ByVal hostBook As Workbook)
import-exports #
Export export specs from setup into the host workbook
Signature:
Private Sub ImportExports(ByVal setupBook As Workbook, ByVal hostBook As Workbook)
import-analysis #
Export analysis from setup into the host workbook
Signature:
Private Sub ImportAnalysis(ByVal setupBook As Workbook, ByVal hostBook As Workbook)
import-formatter #
Export formatter from setup into the host workbook
Signature:
Private Sub ImportFormatter(ByVal setupBook As Workbook, ByVal hostBook As Workbook)
Skips import when the formatter was already imported via the ribbon (clickImpStyle sets TAG_FORMATTER_IMPORTED on the host workbook).
import-translations #
Import translations from setup via LLTranslation.ImportDictionary
Signature:
Private Sub ImportTranslations(ByVal setupBook As Workbook, ByVal hostBook As Workbook)
Gets the first ListObject from the setup Translations worksheet and imports it into the designer LinelistTranslation sheet using LLTranslation.ImportDictionary. Silently exits when either sheet or ListObject is missing.
import-hidden-names #
Export hidden names from setup into the host workbook
Signature:
Private Sub ImportHiddenNames(ByVal setupBook As Workbook, ByVal hostBook As Workbook)
Export Helpers (Designer -> Linelist)
export-dictionary #
Export dictionary from host to target workbook
Signature:
Private Sub ExportDictionary(ByVal hostBook As Workbook, ByVal targetBook As Workbook)
Data in the designer workbook always starts at row 1, col 1 (written by DataSheet.Export during ImportFromSetup), regardless of the original setup file format.
export-choices #
Export choices from host to target workbook
Signature:
Private Sub ExportChoices(ByVal hostBook As Workbook, ByVal targetBook As Workbook)
export-exports #
Export export specs from host to target workbook
Signature:
Private Sub ExportExports(ByVal hostBook As Workbook, ByVal targetBook As Workbook)
export-analysis #
Export analysis from host to target workbook
Signature:
Private Sub ExportAnalysis(ByVal hostBook As Workbook, ByVal targetBook As Workbook)
export-geo #
Export geo from host to target workbook
Signature:
Private Sub ExportGeo(ByVal hostBook As Workbook, ByVal targetBook As Workbook, _
ByVal llName As String, ByVal setupPath As String)
Parameters:
hostBook: Workbook. Designer workbook containing the Geo sheet.targetBook: Workbook. Linelist workbook receiving the geo data.llName: String. Linelist name written as geo metadata.setupPath: String. Setup file path written as geo metadata.
export-passwords #
Export passwords from host to target workbook
Signature:
Private Sub ExportPasswords(ByVal hostBook As Workbook, ByVal targetBook As Workbook)
export-translations #
Export translations from host to target workbook
Signature:
Private Sub ExportTranslations(ByVal hostBook As Workbook, ByVal targetBook As Workbook)
export-formatter #
Export formatter from host to target workbook
Signature:
Private Sub ExportFormatter(ByVal hostBook As Workbook, ByVal targetBook As Workbook)
Post-Export Instance Building
build-exported-instances #
Create domain manager instances from the exported workbook
Signature:
Private Sub BuildExportedInstances(ByVal targetBook As Workbook)
After ExportToLinelist writes sheets into the target workbook, this method creates new domain manager instances pointing to those sheets. Each manager is created only when its corresponding sheet exists in the target workbook. Failures for individual managers are silently ignored so that remaining managers can still be created.
clear-exported-instances #
Reset all exported domain manager references
Signature:
Private Sub ClearExportedInstances()
Internal Helpers
sync-designer-language-names #
Update language HiddenNames on the designer workbook from Main sheet values
Signature:
Private Sub SyncDesignerLanguageNames(ByVal hostBook As Workbook)
Reads the dictionary language from RNG_LangSetup and the interface language from RNG_LLForm on the Main worksheet. Writes these values as workbook-level HiddenNames (RNG_DictionaryLanguage and RNG_LLLanguageCode) on the host workbook so they are current before export. The interface language is split on "-" to extract the code prefix (e.g., "FRA-Fran" & ChrW$(231) & "ais" -> "FRA").
Parameters:
hostBook: Workbook. The designer workbook to update.
export-designer-hidden-names #
Export designer workbook HiddenNames to the target linelist workbook
Signature:
Private Sub ExportDesignerHiddenNames(ByVal hostBook As Workbook, ByVal targetBook As Workbook)
Copies all workbook-level HiddenNames from the designer (host) workbook to the target linelist workbook, including language codes, ribbon flags, and other configuration values. This ensures the linelist workbook has RNG_DictionaryLanguage and RNG_LLLanguageCode available before any LLTranslation.TransObject call.
Parameters:
hostBook: Workbook. The designer workbook (source).targetBook: Workbook. The linelist workbook (destination).
resolve-worksheet #
Resolve a worksheet by name from a workbook
Signature:
Private Function ResolveWorksheet(ByVal wb As Workbook, ByVal sheetName As String) As Worksheet
Returns: Worksheet. The resolved worksheet, or Nothing.
worksheet-exists #
Check whether a worksheet exists in a workbook
Signature:
Private Function WorksheetExists(ByVal wb As Workbook, ByVal sheetName As String) As Boolean
setup-start-row #
Return the data start row based on the setup file format
Signature:
Private Function SetupStartRow(ByVal wb As Workbook, ByVal xlsbRow As Long) As Long
Setup workbooks saved as .xlsb have metadata rows above the data tables (Dictionary at row 5, Choices/Exports at row 4). In .xlsx format the data always starts at row 1.
Parameters:
wb: Workbook. The setup workbook to inspect.xlsbRow: Long. Start row to use for .xlsb files.
Returns: Long. The resolved start row (xlsbRow for .xlsb, 1 otherwise).
read-main-range #
Read a named range value from the Main worksheet
Signature:
Private Function ReadMainRange(ByVal wb As Workbook, ByVal rngName As String) As String
Returns the string value of a named range on the Main sheet of the supplied workbook. Returns vbNullString when the sheet or range is missing.
Parameters:
wb: Workbook. Workbook containing the Main sheet.rngName: String. Named range to read.
Returns: String. Cell value or vbNullString.
close-workbook #
Close a workbook safely without raising errors
Signature:
Private Sub CloseWorkbook(ByRef wb As Workbook)
validate-file-path #
Validate that a file path is not empty and the file exists
Signature:
Private Sub ValidateFilePath(ByVal filePath As String)
throw-error #
Raise a ProjectError-based exception
Signature:
Private Sub ThrowError(ByVal errorCode As ProjectError, ByVal messageText As String)
Interface Implementation
IDesignerImportService_Configure #
Signature:
Private Sub IDesignerImportService_Configure(ByVal hostBook As Workbook)
Delegated members satisfying the IDesignerImportService contract.