Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Custom 2 axis chart saved as template fails to load | Charts and Charting in Excel | |||
NCAA tournament brackets template from Template gallery. | Excel Worksheet Functions | |||
How to load Template Wizard /tracking to operate in Excel 2003? | Excel Discussion (Misc queries) | |||
Where do I find a template for a high school template? | Excel Discussion (Misc queries) | |||
Excel template to load automatically as the default template? | Excel Discussion (Misc queries) |