ID: Q139575
When you record a Visual Basic for applications macro that adds a sheet template to a Microsoft Excel version 7.0 workbook, you will get a line of code similar to the following:
Sheets.Add Type:= "C:\MSOFFICE\TEMPLATES\SHEET.XLT"
When you run this code, you receive the following error message:
Run-Time Error '1004' Add method of sheets class failed
The value for the Type argument must be a Microsoft Excel sheet constant. The sheet constants are as follows:
xlWorksheet
xlChart
xlModule
xlDialogSheet
xlExcel4MacroSheet
xlExcel4IntlMacroSheet
To work around this problem, use the following steps:
1. Save the template as Sheet.xlt in your Excel\Xlstart folder.
2. Restart Microsoft Excel.
Now you can record the macro to insert the template and the recorded macro.
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
Additional query words: 7.00
Keywords : kbprg xlwin
Version : 7.00
Platform : WINDOWS
Last Reviewed: September 3, 1997