Can I add a new worksheet using a template

J

John

I have a formatted excel file with cell formatting plus an inserted bitmap
logo saved on my system as PO Template.xls

Can I add a worksheet using that file as a template?

Set newsheet = MasterWorkBook.Worksheets.Add("C:\Program Files\Bourret
Tools\_POTemplate.xlt")

VBA help says "If you are inserting a sheet based on an existing template,
specify the path to the template. The default value is xlWorksheet."

So is this valid?...

It doesn't work for me!

newsheet is still nothing after this line
 
B

Bernie Deitrick

John,
If the template has only one sheet:

Workbooks.Open "C:\Program Files\Bourret Tools\_POTemplate.xlt"
Worksheets(1).Move after:=ThisWorkbook.ActiveSheet
Set newsheet = ActiveSheet


HTH,
Bernie
MS Excel MVP
 
D

Dave Peterson

Maybe...

dim newSheet as object
set newsheet = masterworkbook.sheets.add(type:="C:\.....")
 

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