Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 238
Error: "Data may have been lost" when stripping macros with template object
When calling the Process method of the ExcelTemplate object, it is possible to strip macros from the template .xls or .xlt file. The third parameter of the process method, ExcludeMacro, is set to False by default. If set to True, macros in the template will be excluded from the generated spreadsheet.

objTemplate.Process "c:\folder\file.xls", saProcessOpenInPlace, True

If your original template .xls or .xlt file contains buttons which are associated with the macros which are being removed, Microsoft Excel will report a "data may have been lost" error when the newly generated spreadsheet is read. In fact, no data is actually lost. All original spreadsheet values, formulas, etc. will still be intact. Microsoft Excel reports this error because the buttons have been orphaned.

If you intend to strip macros when generating a new spreadsheet with ExcelTemplate object, you should remove all of the associated buttons in the original template file.
Related Links
OfficeWriter Home Page
OfficeWriter Enterprise Edition
Latest OfficeWriter News
OfficeWriter: Programmatic Runtime Control

Created : 12/1/2002 12:00:00 AM (last modified : 12/20/2001 11:24:00 AM)
Rate this article!