Q210684 - Need more info on suggested work around section

A

awong

Hi all,



In KB article Q210684, it mentions a work around. (I attached it at the
bottom of this email).



I followed the work around suggestion and created the follow code (I only
extract part of the whole procedure) but it doesn't work neither.

Dim objExcel As Excel.Application

Set objExcel = GetObject(, "Excel.Application")



Dim wkbInvoice As Excel.Workbook

Set wkbInvoice = objExcel.Workbooks.Add(strTemplateLocation)

Dim intSheetCount as Integer

intSheetCount = 200

For IntI = 1 To intSheetCount

Dim intCount As Integer

intCount = wkbInvoice.Worksheets.Count

wkbInvoice.Worksheets("TemplateDetailSheet").Copy
Before:=wkbInvoice.Worksheets (intCount)

Next IntI



I can also repro this problem on EXCEL 2003.



Could someone help? Thanks a lot.



Abel





WORKAROUND
To work around this problem, insert a new worksheet from a template instead
of copying an existing worksheet. To do this:
1.. Create a new workbook, and then delete all of the worksheets except
for one.
2.. Format the workbook and add any text, data, and charts that you must
have in the template by default.
3.. Click File, and then click Save As.
4.. In the File name box, type the name that you want for the Excel
template.
5.. In the Save as type list, click Template(*.xlt), and then click Save.
6.. To insert the template programmatically, use the following code:
Sheets.Add Type:=path\filename

where path\filename is a string that contains the full path and file name
for your sheet template.
7..
 
Top