XL5: DocErr Add Method of Workbooks ClassLast reviewed: September 12, 1996Article ID: Q123576 |
The information in this article applies to:
SYMPTOMSIn Microsoft Excel 5.0, Visual Basic Help states the following about the Template argument for the Add method of the Workbooks collection:
Can be a string specifying a template for the new workbook (the string can include a file path), or a constant to create a new workbook containing a single sheet (one of xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet).This information is incorrect. The correct text is the following:
A constant (one of xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet) that specifies a new workbook is created containing a single sheet of this type. STATUSMicrosoft has confirmed this to be a problem in Visual Basic Help in Microsoft Excel version 5.0. This information has been corrected in Visual Basic Help that is included with Microsoft Excel version 5.0c.
MORE INFORMATIONThe Add method for Workbooks class is equivalent to Choosing New from the File menu and choosing either a custom template or the built-in workbook template. For a custom workbook template to be available in the New dialog box, it must either be in the XLSTART directory or the alternate startup directory. The Alternate startup directory can be set by choosing the General Tab after choosing Options from the Tools menu and typing a path for Alternate Startup File Location. Therefore, adding any other path for the template will not work. If you try to use a different path, you receive the following error message
Run-time error 1004: Add method of workbooks class failedIf a template from another directory needs to be used, use Workbooks.Open instead. For example, you could use the following command:
Workbooks.Open("C:\MYDIR\MYTEMP.XLT") REFERENCESMicrosoft Excel 5.0 Visual Basic Help "Excel 5 Visual Basic for Applications Reference," Microsoft Press, page 38 "User's Guide," version 5.0, Chapters 35-36 To find the Add method in Help, choose the search button in Visual Basic Help and type:
Add Method (Workbooks Collection) |
KBCategory: kbusage kbdocerr
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |