Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Load Template

1. Is it possible to load a Excel template in an existing workbook?
2. Also, is it possible to know from the workbook which template it has
loaded?

I used Application.WorkBooks.Add() but this opens a new workbook.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Load Template

You can specify the template to open as an argument to Workbooks.Add

Workbooks.Add Template:="C:\Templates\myTemplate.xlt"

--
HTH

Bob Phillips

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

"rahul" wrote in message
...
1. Is it possible to load a Excel template in an existing workbook?
2. Also, is it possible to know from the workbook which template it has
loaded?

I used Application.WorkBooks.Add() but this opens a new workbook.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Load Template

I want to load a template in an existing workbook!

"Bob Phillips" wrote:

You can specify the template to open as an argument to Workbooks.Add

Workbooks.Add Template:="C:\Templates\myTemplate.xlt"

--
HTH

Bob Phillips

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

"rahul" wrote in message
...
1. Is it possible to load a Excel template in an existing workbook?
2. Also, is it possible to know from the workbook which template it has
loaded?

I used Application.WorkBooks.Add() but this opens a new workbook.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Load Template

You could try recording a macro of this action.
You would get something like:
Sheets.Add Type:="C:\Path to your templates\Template.xlt"

NickHK

"rahul" wrote in message
...
I want to load a template in an existing workbook!

"Bob Phillips" wrote:

You can specify the template to open as an argument to Workbooks.Add

Workbooks.Add Template:="C:\Templates\myTemplate.xlt"

--
HTH

Bob Phillips

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

"rahul" wrote in message
...
1. Is it possible to load a Excel template in an existing workbook?
2. Also, is it possible to know from the workbook which template it

has
loaded?

I used Application.WorkBooks.Add() but this opens a new workbook.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Load Template

Can you let me know the parameter to be passed in C#?
I am getting an exception. The API signature is

object Add(
[In, Optional] object Before,
[In, Optional] object After,
[In, Optional] object Count,
[In, Optional] object Type
);

I dont know what to pass in the fourth parameter. I passed the template
location but I am getting an exception 0x800A03EC.

I am making this api call
application.ActiveWorkbook.Worksheets.Add(Type.Mis sing,Type.Missing,Type.Missing,
@"c:\Documents and Settings\raverma\My Documents\Visual Studio
2005\Projects\ExcelWordAddins\Sample.xlt");
"NickHK" wrote:

You could try recording a macro of this action.
You would get something like:
Sheets.Add Type:="C:\Path to your templates\Template.xlt"

NickHK

"rahul" wrote in message
...
I want to load a template in an existing workbook!

"Bob Phillips" wrote:

You can specify the template to open as an argument to Workbooks.Add

Workbooks.Add Template:="C:\Templates\myTemplate.xlt"

--
HTH

Bob Phillips

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

"rahul" wrote in message
...
1. Is it possible to load a Excel template in an existing workbook?
2. Also, is it possible to know from the workbook which template it

has
loaded?

I used Application.WorkBooks.Add() but this opens a new workbook.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Load Template

You have to use the .Sheets collection not the .Worksheets collection.

Otherwise the Worksheets.Add method expects, for Type:
<From Help
Type Optional Variant. Specifies the sheet type. Can be one of the
following XlSheetType constants: xlWorksheet, xlChart, xlExcel4MacroSheet,
or xlExcel4IntlMacroSheet. The default value is xlWorksheet.
</From Help
Although the help is not clear on the above difference.

You could get your code working in Excel, with the help of the macro
recorder and Object Browser first, to use the correct syntax, methods etc,
then translate to C#.

NickHK

"rahul" wrote in message
...
Can you let me know the parameter to be passed in C#?
I am getting an exception. The API signature is

object Add(
[In, Optional] object Before,
[In, Optional] object After,
[In, Optional] object Count,
[In, Optional] object Type
);

I dont know what to pass in the fourth parameter. I passed the template
location but I am getting an exception 0x800A03EC.

I am making this api call

application.ActiveWorkbook.Worksheets.Add(Type.Mis sing,Type.Missing,Type.Mis
sing,
@"c:\Documents and Settings\raverma\My Documents\Visual Studio
2005\Projects\ExcelWordAddins\Sample.xlt");
"NickHK" wrote:

You could try recording a macro of this action.
You would get something like:
Sheets.Add Type:="C:\Path to your templates\Template.xlt"

NickHK

"rahul" wrote in message
...
I want to load a template in an existing workbook!

"Bob Phillips" wrote:

You can specify the template to open as an argument to Workbooks.Add

Workbooks.Add Template:="C:\Templates\myTemplate.xlt"

--
HTH

Bob Phillips

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

"rahul" wrote in message
...
1. Is it possible to load a Excel template in an existing

workbook?
2. Also, is it possible to know from the workbook which template

it
has
loaded?

I used Application.WorkBooks.Add() but this opens a new workbook.








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
Custom 2 axis chart saved as template fails to load ALV Charts and Charting in Excel 0 December 5th 07 09:02 PM
NCAA tournament brackets template from Template gallery. smcclements Excel Worksheet Functions 2 March 16th 07 02:33 PM
How to load Template Wizard /tracking to operate in Excel 2003? Template Problems Excel Discussion (Misc queries) 1 November 16th 05 02:42 PM
Where do I find a template for a high school template? pluspoola Excel Discussion (Misc queries) 0 July 1st 05 02:35 AM
Excel template to load automatically as the default template? David Excel Discussion (Misc queries) 1 March 21st 05 12:24 PM


All times are GMT +1. The time now is 07:30 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"