Eis uma forma rápida de importação de tabelas .DBF para arquivos .CSV e/ou .XLS de forma rápida:
oExcel := TOleAuto():New( "Excel.Application" )
oWorkbook := oExcel:WorkBooks
oWorkbook:Open( "c:\temp\tabela.DBF" )
oExcel:DisplayAlerts := .f.
oExcel:Visible := .t.
oWorksheet := oExcel:Get( "ActiveSheet" )
oWorksheet:SaveAs( "c:\temp\tabela.CSV", 6 ) // Segundo parâmetro informa o tipo de saÃda
oWorksheet:SaveAs( "c:\temp\tabela.XLS", 56 ) // Segundo parâmetro informa o tipo de saÃda
Só não resolvi o processo preso na task manager.
Informativo:
fonte: https://support.microsoft.com/pt-br/help/291308/how-to-select-cells-ranges-by-using-visual-basic-procedures-in-excel
// Defines para o segundo parâmetro
#define xlCSV 6 // CSV *.csv
#define xlCSVMSDOS 24 // MSDOS CSV *.csv
#define xlCSVWindows 23 // Windows CSV *.csv
#define xlDBF3 8 // Dbase 3 format *.dbf
#define xlExcel8 56 // Excel 97-2003 Workbook *.xls
#define xlHtml 44 // HTML format *.htm; *.html
#define xlTextMSDOS 21 // MSDOS Text *.txt
#define xlWorkbookNormal -4143 // Workbook normal *.xls