Microsoft: Visual FoxPro FAQ

COM and Automation

This creates an excel file with a work sheet labled with the table name. each sheet list the field name with the data type and format.

close databasesopen database data\pcmlnf = 0lnt = 0sloc = ''

obj = createobject('excel.application')** set excel to only have one worksheetobj.Application.SheetsInNewWorkbook = 1** delete the work book that has three worksheetsobj.Application.Workbooks.closenow add a new book with only one worksheetobj.Application.Workbooks.Add

** uncoment this line to watch it work.*obj.Application.visible = .t.

** fox fuction to get table list from open databaselnt = ADBOBJECTS(gaTables, "TABLE")

** loop through list of tablesfor i = 1 to lnt use gaTables(i) lnf = afields(gaFields,gaTables(i))