April 2006
Beginner
1114 pages
98h 16m
English
The way Excel comes from Microsoft, new workbooks contain three worksheets and no charts or other sheets. You can change this by setting Excel’s Options (Tools → Options → General tab), but sometimes you just want to create a workbook with one worksheet in code, leaving the Option settings alone. There’s an easy way to do this:
Set wb = Workbooks.Add(XlWBATemplate.xlWBATWorksheet)
The preceding line creates a new workbook containing one worksheet. You can use a similar line to create a workbook containing one chart:
Set wb = Workbooks.Add(XlWBATemplate.xlWBATChart)
Of course, you can also use the Add method to create a new workbook based on a template, as shown here:
Set wb = Workbooks.Add("C:\Program Files\Microsoft
Office\Templates\1033\timecard.xlt")Read now
Unlock full access