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 databases
open database data\pcm
lnf = 0
lnt = 0
sloc = '
obj = createobject('excel.application')
** set excel to only have one worksheet
obj.Application.SheetsInNewWorkbook = 1
** delete the work book that has three worksheets
obj.Application.Workbooks.close
now add a new book with only one worksheet
obj.Application.Workbooks.Add
** uncoment this line to watch it work.
*obj.Application.visible = .t.
** fox fuction to get table list from open database
lnt = ADBOBJECTS(gaTables, "TABLE")
** loop through list of tables
for i = 1 to lnt
use gaTables(i)
lnf = afields(gaFields,gaTables(i))
** avoid adding a worksheet on the first time around
if i != 1
obj.Application.Workbooks(1).worksheets.Add
endif
obj.Application.Workbooks(1).Worksheets(1).activate
obj.Application.Workbooks(1).Worksheets(1).name = gaTables(i)
use
obj.Application.Workbooks(1).Worksheets(1).cells(1,1).Value = 'Name'
obj.Application.Workbooks(1).Worksheets(1).cells(1,2).Value = 'Char Type'
obj.Application.Workbooks(1).Worksheets(1).cells(1,3).Value = 'Width'
obj.Application.Workbooks(1).Worksheets(1).cells(1,4).Value = 'Dec. Pos'
for j = 1 to lnf
obj.Application.Workbooks(1).Worksheets(1).cells(j+1,1).Value = gaFields(j,1)
obj.Application.Workbooks(1).Worksheets(1).cells(j+1,2).Value = gaFields(j,2)
obj.Application.Workbooks(1).Worksheets(1).cells(j+1,3).Value = gaFields(j,3)
obj.Application.Workbooks(1).Worksheets(1).cells(j+1,4).Value = gaFields(j,4)
next
next
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.