Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Adding new worksheet from template in code

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Adding new worksheet from template in code

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)

"E.J. van Wijngaarden" wrote in message
...
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Adding new worksheet from template in code

This worked for me:

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

(don't use worksheets.add)



"E.J. van Wijngaarden" wrote:

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


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a "relationship code" to a worksheet pat67 Excel Worksheet Functions 4 January 18th 10 09:18 PM
Adding additional worksheets to an existing template Mike F Excel Discussion (Misc queries) 2 November 20th 08 07:18 PM
Adding a new Excel template Anonymous Excel Discussion (Misc queries) 1 September 26th 05 09:40 PM
Excel template-run code on open Cindy Excel Programming 0 January 28th 04 04:19 PM
Check my code to use template? Ed[_9_] Excel Programming 1 July 23rd 03 03:04 AM


All times are GMT +1. The time now is 02:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"