View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 923
Default Worksheets.Add won't let me specify a template

I got the same problem xL2002. I usually use the workbooks.add template
method which works OK. But it is worth noting this inconsistency. Thanks

--
Cheers
Nigel



"byundt" wrote in message
...
In Excel 2003, the documentation for Worksheets.Add suggests that I can

use
the Type parameter to specify a path to a template for an added worksheet.
This works with Sheets.Add, but produces a 1004 run-time error with
Worksheets.Add
Although the workaround is simple, the on-line help ought to be changed.

The following code will demonstrate the error in Excel 97, 2000, 2002 and
2003:

Sub NewSheet()
'This statement produces Run-time error 1004, Method 'Add' of object
'Sheets' failed
Worksheets.Add Type:="C:\VBA\Temp\Sheet1.xlt"

Sheets.Add Type:="C:\VBA\Temp\Sheet1.xlt" 'This statement works
End Sub