Hi,
This is an old thread from v8, but i want to give it another go. I am attempting to export a dbf to excel from a dialog component. In my aftervalidate i have placed the following code...
I must have the syntax wrong as it does not work. Can anyone spot the mistakes.
Basically, I want to export one field (Issue_ID2) from tbl_issues_log.dbf into Test.xls, whilst changing the header to a more appropriate name.
Thanks,
Denis
This is an old thread from v8, but i want to give it another go. I am attempting to export a dbf to excel from a dialog component. In my aftervalidate i have placed the following code...
Code:
fname = "TestExcel.xls" child_db_name = "[PathAlias.ADB_Path]\tbl_issues_log.dbf" result = make_excel(fname, Child_db_name) Dim xlApp as p dim myCell as c xlApp = ole.create("Excel.Application") xlApp.Workbooks.Add() 'adds a workbook object xlApp.ActiveSheet.Name = "Issues Data" xlApp.Visible = .T. 'comment this line out if you don't want to see Excel tbl = table.open("[PathAlias.ADB_Path]\tbl_issues_log.dbf") ctr = 1 ' Set Column Widths For Last Name, First Name & Received Date cellwidth = tbl.Issue_id2.Width_get() myCell = "A1" xlApp.Sheets(1).Range(myCell).Select xlApp..ActiveCell.ColumnWidth = cellwidth ' Make Headers myCell = "A" + alltrim(str(ctr)) xlApp.Sheets(1).Range(myCell).Select 'selects a cell xlApp.ActiveCell.FormulaR1C1 = "Issue ID" 'adds text to that cell 'Now add actual info found = tbl.fetch_first() while tbl.fetch_eof() = .F. ctr = ctr + 1 myCell = "A" + alltrim(str(ctr)) xlApp.Sheets(1).Range(myCell).Select xlApp..ActiveCell.FormulaR1C1 = tbl.Issue_id2 tbl.fetch_next(1) end while xlApp.ActiveWorkbook.Saveas(FileName) delete xlApp
Basically, I want to export one field (Issue_ID2) from tbl_issues_log.dbf into Test.xls, whilst changing the header to a more appropriate name.
Thanks,
Denis
Comment