Article ID: 108350 - Last Review: October 10, 2006 - Revision: 2.2 Distinguishing Sheet Types with Visual Basic MacroThis article was previously published under Q108350 SUMMARY
You can use the Microsoft Visual Basic for Applications TypeName function
to return each type of sheet available in Microsoft Excel. Because the
Worksheet type can apply to worksheets, MS Excel 4.0 Macro sheets, or MS
Excel 4.0 International Macro sheets, you must use the Type property along
with the TypeName function to return the specific type of worksheet.
The sample macro (Sub procedure) in the "More Information" section of this article displays the appropriate sheet name for each sheet:
Chart DialogSheet Module (except in Microsoft Excel 97 and Microsoft Excel 98) MS Excel 4.0 Macro Sheet MS Excel 4.0 International Macro Sheet Worksheet MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
The following Visual Basic code examples assume that you have a workbook
that contains one worksheet, one MS Excel 4.0 Macro sheet, one chart sheet,
one dialog sheet, and one Visual Basic module, in that order. The code
example is located in the Visual Basic module.
To run the macro, position the insertion point in the line that reads "Sub Sheet_Type()" and click Start on the Run menu.
Worksheet, MS Excel 4.0 Macro Sheet, Chart, DialogSheet, Module
NOTE: In Microsoft Excel 97 and Microsoft Excel 98, you do not receive a
message box for the module. This occurs because of the design of the
Visual
Basic Editor in these versions of Microsoft Excel. | Article Translations
|


Back to the top
