Skip to content

VBAToolKit feature : Recreate Configuration

lucas-v edited this page Nov 19, 2013 · 3 revisions

VBAToolKit is able to recreate the Excel file corresponding to a configuration.

What it does (from a user point of view)

A configuration is described by a name, a path, and a number of modules.

When asked to recreate a configuration, VBAToolKit creates an Excel file :

  • containing all the modules described in the configuration

  • whose VBProject object has the name of the configuration.

  • whose name is the same than in the indicated path

  • whose file type is consistent with the extension indicated in the path (for example, a .xlam configuration will be recreated as an Excel add-in)

The recreation of configurations is accessible via a form that can be viewed by clicking the according button in the VBAToolKit ToolBar Recreate Configuration Icon.
It is possible to create either a single configuration, either every configuration except the one selected. This is handy when we don't want to recreate the DEV configuration we are working on.
Empty Recreate Configuration User Form
It is impossible to recreate a configuration corresponding to an open Excel workbook.

How it does it (from a programmer point of view)

  • Firstly, VBAToolKit gets the list of projects and their respective location information from the "remembered projects" file, described here. The module dedicated to this purpose is vtkProjects.

  • Then, it uses this information to compute the location the XML description file that describes the wanted project.

  • VBAToolKit then creates a dedicated vtkConfigurationManager object to read from the file and get the project information.

  • The vtkRecreateConfiguration function uses the information found in the XML file and the modules found at the paths indicated in the XML file.

The vtkRecreateConfiguration function creates a Workbook object, fills it with the relevant data (modules, project title, etc), and saves it at the indicated path, with the relevant fileformat.

The filetypes corresponding to the extensions are :

xlsx -> xlOpenXMLWorkbook
xltx -> xlOpenXMLTemplate
xltm -> xlOpenXMLTemplateMacroEnabled
xlsm -> xlOpenXMLWorkbookMacroEnabled
xlam -> xlOpenXMLAddIn
xla  -> xlAddIn
xls  -> xlExcel8

Tips about the UserForm

  • A green path indicates a valid path.

    • for a folder or a template, it indicates that the object exists in the file system.
    • for an XML file, it indicates that the file exists ad is loadable without problems, that is to say : is compliant with the embedded DTD.
  • A red path indicates that the object does not exist in the file system.

  • An orange path is only used for XML files : it indicates that the file could be found but could not be loaded : there is a problem, probably with the DTD. In the near future, a button to diagnose the problem could be put near the text field.

  • The Create Configuration button will only be enabled if :

    • a project is selected
    • a configuration is selected
    • the template (if any) needed for creating the configuration can be found.
Clone this wiki locally