Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default creating a new worksheet from a template using VBA

Hi,

I am having a problem creating a worksheet from a template using a
click-button.

Private Sub cmdNewWorksheet_Click()
Worksheets.Add Befo=Worksheets("Finish")
Worksheets(Worksheets.Count - 1).Name = txtNewWorksheet.Text
txtNewWorksheet.Text = ""
End Sub

I have a template set up, template1.xlt, with a worksheet created in this
called template.

Does anyone have any ideas?

Any help will be much appreciated.

Thank you in advance.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default creating a new worksheet from a template using VBA

You can just use

Sheets.Add Type:= "C:\myTemplate.xlt"

Before seems to fail with this option, but you could move it afterwards.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"David Coyle" <David wrote in message
...
Hi,

I am having a problem creating a worksheet from a template using a
click-button.

Private Sub cmdNewWorksheet_Click()
Worksheets.Add Befo=Worksheets("Finish")
Worksheets(Worksheets.Count - 1).Name = txtNewWorksheet.Text
txtNewWorksheet.Text = ""
End Sub

I have a template set up, template1.xlt, with a worksheet created in this
called template.

Does anyone have any ideas?

Any help will be much appreciated.

Thank you in advance.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default creating a new worksheet from a template using VBA

Thanks!

for some reason, the code worked when i removed the 'work' from 'worksheets'

Private Sub cmdNewSheet_Click()
Sheets.Add Befo=Sheets("Finish"), Type:="C:\template1.xlt"
Sheets(Sheets.Count - 1).Name = txtNewSheet.Text
txtNewSheet.Text = ""
End Sub

Much Appreciated.

"Bob Phillips" wrote:

You can just use

Sheets.Add Type:= "C:\myTemplate.xlt"

Before seems to fail with this option, but you could move it afterwards.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"David Coyle" <David wrote in message
...
Hi,

I am having a problem creating a worksheet from a template using a
click-button.

Private Sub cmdNewWorksheet_Click()
Worksheets.Add Befo=Worksheets("Finish")
Worksheets(Worksheets.Count - 1).Name = txtNewWorksheet.Text
txtNewWorksheet.Text = ""
End Sub

I have a template set up, template1.xlt, with a worksheet created in this
called template.

Does anyone have any ideas?

Any help will be much appreciated.

Thank you in advance.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default creating a new worksheet from a template using VBA

Odd, I tried that and it didn't for me?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"David Coyle" wrote in message
...
Thanks!

for some reason, the code worked when i removed the 'work' from

'worksheets'

Private Sub cmdNewSheet_Click()
Sheets.Add Befo=Sheets("Finish"), Type:="C:\template1.xlt"
Sheets(Sheets.Count - 1).Name = txtNewSheet.Text
txtNewSheet.Text = ""
End Sub

Much Appreciated.

"Bob Phillips" wrote:

You can just use

Sheets.Add Type:= "C:\myTemplate.xlt"

Before seems to fail with this option, but you could move it afterwards.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"David Coyle" <David wrote in message
...
Hi,

I am having a problem creating a worksheet from a template using a
click-button.

Private Sub cmdNewWorksheet_Click()
Worksheets.Add Befo=Worksheets("Finish")
Worksheets(Worksheets.Count - 1).Name = txtNewWorksheet.Text
txtNewWorksheet.Text = ""
End Sub

I have a template set up, template1.xlt, with a worksheet created in

this
called template.

Does anyone have any ideas?

Any help will be much appreciated.

Thank you in advance.







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
Excel Template (Creating a Function in the template) Té Excel Worksheet Functions 3 March 6th 09 07:17 AM
Creating a worksheet/template for Mileage Sisell Excel Worksheet Functions 4 February 26th 09 06:50 PM
Creating summary worksheet from template Ballwin Tom New Users to Excel 7 July 22nd 08 10:39 PM
creating template enyaw Excel Programming 7 April 28th 06 12:55 AM
Creating a new worksheet from a template username Excel Discussion (Misc queries) 0 May 19th 05 04:36 PM


All times are GMT +1. The time now is 10:39 PM.

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"