Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Carry range names into copy of template

I have a template with named ranges. I want to use VBA to copy the template
into another workbook and have the names of the ranges carried into the new
workbook. I can get the template into the new workbook, but none of the
ranges are named.

Any ideas?

Thank you for the assistance.

Don
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Carry range names into copy of template

i dont understand why you want to copy it to a new workbook.If you open a
true template ie an xlt file it always opens as a new copy of itself
use
Workbooks.Add Template:=
not
Workbooks.Open Filename:=




--
paul
remove nospam for email addy!



"Don Rouse" wrote:

I have a template with named ranges. I want to use VBA to copy the template
into another workbook and have the names of the ranges carried into the new
workbook. I can get the template into the new workbook, but none of the
ranges are named.

Any ideas?

Thank you for the assistance.

Don

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Carry range names into copy of template

The template is one sheet. I want to insert it as a sheet in a multi sheet
workbook not open it as a separate workbook or separate template.

"paul" wrote:

i dont understand why you want to copy it to a new workbook.If you open a
true template ie an xlt file it always opens as a new copy of itself
use
Workbooks.Add Template:=
not
Workbooks.Open Filename:=




--
paul
remove nospam for email addy!



"Don Rouse" wrote:

I have a template with named ranges. I want to use VBA to copy the template
into another workbook and have the names of the ranges carried into the new
workbook. I can get the template into the new workbook, but none of the
ranges are named.

Any ideas?

Thank you for the assistance.

Don

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Carry range names into copy of template

How are you getting the template to the new workbook?

Are you opening the template workbook, then copying the worksheet (not the
cells, but the worksheet), then closing the template?

I think that would work.

And if you just want to add a new sheet based on a template to an existing
workbook:

Option Explicit
Sub testme()
Dim newWks As Object
Set newWks = Sheets.Add(Type:="C:\my documents\excel\book1.xlt")
End Sub


I think if I were doing this, I'd make sure those names were sheet level
names--not workbook level names.

Insert|Name|Define
Names in Workbook: Sheet1!myNameHere
Refers to: =Sheet1!$C$6:$G$15

Then I could add the sheet as many times as I want and not have to worry about
name conflicts.

======
And if you're working with names, get a copy of Jan Karel Pieterse's (with
Charles Williams and Matthew Henson)
Name Manager:

You can find it at:
NameManager.Zip from http://www.oaltd.co.uk/mvp

You'll be very happy you did.

Don Rouse wrote:

I have a template with named ranges. I want to use VBA to copy the template
into another workbook and have the names of the ranges carried into the new
workbook. I can get the template into the new workbook, but none of the
ranges are named.

Any ideas?

Thank you for the assistance.

Don


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Carry range names into copy of template

Thank you, Dave. Problem solved.

Don

"Dave Peterson" wrote:

How are you getting the template to the new workbook?

Are you opening the template workbook, then copying the worksheet (not the
cells, but the worksheet), then closing the template?

I think that would work.

And if you just want to add a new sheet based on a template to an existing
workbook:

Option Explicit
Sub testme()
Dim newWks As Object
Set newWks = Sheets.Add(Type:="C:\my documents\excel\book1.xlt")
End Sub


I think if I were doing this, I'd make sure those names were sheet level
names--not workbook level names.

Insert|Name|Define
Names in Workbook: Sheet1!myNameHere
Refers to: =Sheet1!$C$6:$G$15

Then I could add the sheet as many times as I want and not have to worry about
name conflicts.

======
And if you're working with names, get a copy of Jan Karel Pieterse's (with
Charles Williams and Matthew Henson)
Name Manager:

You can find it at:
NameManager.Zip from http://www.oaltd.co.uk/mvp

You'll be very happy you did.

Don Rouse wrote:

I have a template with named ranges. I want to use VBA to copy the template
into another workbook and have the names of the ranges carried into the new
workbook. I can get the template into the new workbook, but none of the
ranges are named.

Any ideas?

Thank you for the assistance.

Don


--

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
Copy/Paste Doesn't Carry Formats Selahgal Excel Worksheet Functions 1 April 6th 09 05:07 PM
copy formula from 1 workbook to another & not carry the extension bpittman Excel Worksheet Functions 3 November 12th 07 03:23 PM
i need a template to carry out vat returns in excel 1910809johnb Excel Worksheet Functions 0 May 4th 05 12:03 AM
copy sheet1 and name sheets using names from a range DL[_3_] Excel Programming 2 September 2nd 03 12:58 PM


All times are GMT +1. The time now is 11:35 PM.

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

About Us

"It's about Microsoft Excel"