Adding new worksheet from template in code

  • Thread starter E.J. van Wijngaarden
  • Start date
E

E.J. van Wijngaarden

Hello,

I need to be able to add a new worksheet from code, using an existing
(1-sheet) template.
I can only find code to open a complete new workbook using an exisiting
template.

Is this possible? If yes, how?

Thanks for your answers.

Ed van Wijngaarden
 
B

Bob Phillips

Hi Ed,

Create a template file as you require, and save it as a template file in the
Excel XLStart directory named Sheet. When you add a new sheet

ACtiveWorkbook.Worksheets.Add

it will be based upon this template.

Main problem, all sheets you add, in code or manually will have this
template. But new workbooks don't have to, you can create a separate
template file called Book for that, again in XLStart.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
D

Dave Peterson

This worked for me:

Sheets.Add Type:="c:\my documents\excel\book3.xls"

(don't use worksheets.add)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top