XL7: Macro Recorded to Add Sheet Template Incorrect

ID: Q139575


The information in this article applies to:
  • Microsoft Excel for Windows 95, version 7.0


SYMPTOMS

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


CAUSE

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


WORKAROUND

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.


STATUS

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional query words:

Keywords : kbprg xlwin
Version : WINDOWS:7.0
Platform : WINDOWS
Issue type :


Last Reviewed: October 25, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.