ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding a new sheet based on a template (https://www.excelbanter.com/excel-programming/309007-adding-new-sheet-based-template.html)

JVZ

Adding a new sheet based on a template
 
I need to add a new worksheet using the VBA ADD method. How can I specify
the worksheet template I want to base the worksheet on?

Thanks, and sorry for my english



Ron de Bruin

Adding a new sheet based on a template
 
Use this

Sheets.Add Type:=Application.TemplatesPath & "\xxxxx.xlt"


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JVZ" wrote in message ...
I need to add a new worksheet using the VBA ADD method. How can I specify
the worksheet template I want to base the worksheet on?

Thanks, and sorry for my english





Tom Ogilvy

Adding a new sheet based on a template
 
I am not sure you can do it with ADD, but

set wkbk = workbooks.open( filename:= _
"C:\MyTemplates\Workbook1.xls")
wkbk.Worksheets(1).copy After:=thisworkbook.Worksheets( _
thisworkbook.Worksheets.count)

wkbk.close Savechanges:=False

--
Regards,
Tom Ogilvy


"JVZ" wrote in message
...
I need to add a new worksheet using the VBA ADD method. How can I specify
the worksheet template I want to base the worksheet on?

Thanks, and sorry for my english






All times are GMT +1. The time now is 01:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com