Add sheet to excel workbook based on template

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to export a bill of materials from AutoCAD to an Excel workbook.
I know how to start excel, start a new workbook based on a template and how to export the BOM.
Now I would like to add a sheet based on a template to the workbook.
(setq xlsapp (vlax-get-or-create-object "Excel.Application")) ;; Start Excel
(vlax-put-property xlsapp "Visible" :vlax-true)
(setq workbooks (vlax-get xlsapp "workbooks"))
(setq WorkBook (vlax-invoke WorkBooks 'open templatefile)) ;; Start with template
(setq sheets (vlax-get workbook 'worksheets)) ;; get sheets collection
(setq newSheet (vlax-invoke sheets 'add )) ;; Add empty sheet. Works fine
(setq newSheet (vlax-invoke sheets 'add templateSheetfile)) ;; does NOT work.
What do I have to add to the function to make it work ?