The PETRAS application files for this chapter can be found on the CD in the folder \Application\Ch11Interfaces and include the following files:
PetrasTemplate.xlt The timesheet template
PetrasAddin.xla The timesheet data-entry support add-in
PetrasReporting.xla The main reporting application
PetrasConsolidation.xlt A template to use for new results workbooks
Debug.ini A dummy file that tells the application to run in debug mode
PetrasIcon.ico An icon file, to use for Excel''s main window
The PETRAS timesheet add-in has not been updated for this chapter.
At this stage in the development of the application, it would be artificial to add a suite of userforms, just so we could demonstrate the implementation of a plug-in architecture. However, such a suite of forms will be added to the application in Chapter 13 Programming with Databases for maintenance of the static lists of Consultants, Clients, Projects and so forth.
For this chapter, we will modify the progress bar handling to display the consolidation progress unobtrusively in the status bar if we''re consolidating fewer than ten timesheet workbooks, but pop up a cancelable progress bar userform if consolidating ten or more timesheets. As such, we''ll be including the IProgressBar interface from Listing 11-15, the FProgressBar form from Listing 11-16 and the CProgressBar class from Listing 11-17. In this example, the form has an extra Cancel button and the interface has been enhanced to add a Cancelled property, set to True when the Cancel button is clicked. The code changes required for this enhancement are detailed in Chapter 11
Module
Procedure
Change
IProgressBar (new class)
Added class to define the IProgressBar interface, copied from Listing 11-15, adding Cancelable property.
CProgressBar (new class)
Added class to show the progress in the status bar, copied from Listing 11-17.
FProgressBar
Moved various methods to be exposed through the IProgressBar interface instead of the default interface. The resulting code is similar to Listing 11-16.
MSystemCode
ConsolidateWorkbooks
Modified to use the IProgressBar interface and test whether to use the CProgressBar class or FProgressBar form.