Thread: Load Template
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
rahul rahul is offline
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.