How to store data in predefined excel Template

Hi ,

I have predefined Excel Template which is given by client. The Excel Template contains header description and each column is formatted according to data fields. I have to store information in that predefined excel template. Iam not getting how to store information in already predefined format.

The file name extension for this is *.xlt

If any one had done this then pls help me.

Thanks & Regards
 

Casper

ProgressTalk.com Moderator
Staff member
AFAIK a xlt file is merely a file which holds Excel settings.
You can open a workbook with a specific template by using the add method:

from msdn on the workbooks:add() method:
Creates a new workbook. The new workbook becomes the active workbook. Returns a Workbook object.

expression.Add(Template)
expression Required. An expression that returns a Workbooks object.
Template Optional Variant. Determines how the new workbook is created. If this argument is a string specifying the name of an existing Microsoft Excel file, the new workbook is created with the specified file as a template. If this argument is a constant, the new workbook contains a single sheet of the specified type. Can be one of the following XlWBATemplate constants: xlWBATChart, xlWBATExcel4IntlMacroSheet, xlWBATExcel4MacroSheet, or xlWBATWorksheet. If this argument is omitted, Microsoft Excel creates a new workbook with a number of blank sheets (the number of sheets is set by the SheetsInNewWorkbook property).

Remark:
If the Template argument specifies a file, the file name can include a path.

For the rest you just have to handle Excel like you always do.
You just have to figure out where you need the data.

HTH,

Casper.
 
Hi

Casper I got some idea from your posting and I opened the existing excel template and assigned the same thing to the handle.

Now it is working perfectly.

thanks
 
Top