XL97: How to Programmatically Reset a Workbook to Default Styles (247980)
The information in this article applies to:
- Microsoft Excel 97 for Windows
This article was previously published under Q247980 For a Microsoft Excel 2002 version of this article, see 291321.
For a Microsoft Excel 2000 version of this article, see 247933.
For a Microsoft Excel 98 version of this article, see 247981.
For a Microsoft Excel 7.0 version of this article, see 247982.
SUMMARY
The following Microsoft Visual Basic for Applications Sub procedure removes all styles in a Microsoft Excel workbook and then adds back the default styles you see in a new workbook. This macro may be helpful for removing extra styles added to a workbook infected by a macro virus.
This macro uses the Workbooks.Add method, which bypasses templates in the startup directories. Because of this, it works correctly even if templates in the startup directories have had extra styles added to them. NOTE: The Excel File Recovery Macro has an option to remove all formatting from a workbook.
For additional information about how to download the Excel File Recovery Macro, click the article number below
to view the article in the Microsoft Knowledge Base:
142117 XL: Summary of Methods to Recover Data from Corrupted Files
REFERENCESFor additional information about how to identify and remove the PLDT/CAR/SGV macro viruses, click the article number below
to view the article in the Microsoft Knowledge Base:
176807 XL: How to Identify and Remove PLDT/CAR/SGV Macro Viruses
For more information about how to use the sample code in this article,
click the article number below to view the article in the Microsoft
Knowledge Base:
173707
OFF97: How to Run Sample Code from Knowledge Base Articles
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbdtacode kbhowto KB247980 |
---|
|