>thanks Eric,
>I am really sorry to bug you, but can you look at this and tell me what is wrong with this.
>
>I am trying to create a table on C drive(That is the objective), run a loop and add the field names first. I can add the values later.
>****************************************************************
>
>Option Explicit
>Public xl As Excel.Application
>_________________________________________________________________
>
>
>on click of some button()
>Dim TBLfields As Interger
>
>Set xl = New Excel.Application
>xl.Workbooks.Add
>xl.CreateWorkbook "C:\parseSTR.xls", True
>xl.Visible = False
>ApExcel.Columns("A:AY").EntireColumn.AutoFit
>
>For TBLfields = 1 To 55
> xl.ActiveWorkbook.ActiveSheet.Cells(1, TBLfields).Value = "FieldName"
>Next TBLfields
>
>END SUB
>____________________________________________________________________________
>
>this is giving me an error, User Defind Type not found.
>Do I have to Add certain component to this project?
>
>I appreciate this.
>
>Lal
You have to reference Microsoft Excel. Also, your variable named TBLfields must me defined as
Integer (a typo in error).
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com