Importando de planilha Excel - nome da planilha
Enviado: 26 Mai 2012 00:22
Link a LIB xhb.lib e hbwin.lib
Em homenagem a Paulo Cesar Toledo
https://pctoledo.org/
Código: Selecionar todos
*************
//Function Main() // (Arq1,Arq2)
*************************
//setmode(25,80)
Arq1="G:\conv\tmprod.xls" // "D:\mmv3\test1"
Arq2="G:\conv\tmprod.dbf" //"D:\mmv3\TESTE9" ** esse Arquivo sera criado em tempo de execucao
XLS2DBF( Arq1, Arq2 )
return nil
**************************************
FUNCTION XLS2DBF( cXlsName, cDbfName )
**************************************
*
* Purpose: convert an Excel spreadsheet to a dBase III+ table
* but does not leave Excel open
*
LOCAL oExcel := Win_OleCreateObject( "Excel.Application" )
//LOCAL oExcel := xhb_GetActiveObject( "Excel.Application" )
LOCAL oWorkBook, oSheet
oWorkbook = oExcel:WorkBooks:Open( cXlsName )
oSheet = oExcel:ActiveSheet
oSheet:SaveAs( cDbfName, xlDbf3 )
oWorkBook:Close( False )
oExcel:Quit()
oSheet := NIL
oWorkBook := NIL
oExcel := NIL
RETURN( NIL )
Código: Selecionar todos
HbMk2 NomeDoTeuPrg hbwin.hbcCódigo: Selecionar todos
*************
02 //Function Main() // (Arq1,Arq2)
03 *************************
04 //setmode(25,80)
05 Arq1="G:\conv\tmprod.xls" // "D:\mmv3\test1"
06 Arq2="G:\conv\tmprod.dbf" //"D:\mmv3\TESTE9" ** esse Arquivo sera criado em tempo de execucao
07 XLS2DBF( Arq1, Arq2 )
08 return nil
09
10 **************************************
11 FUNCTION XLS2DBF( cXlsName, cDbfName )
12 **************************************
13 *
14 * Purpose: convert an Excel spreadsheet to a dBase III+ table
15 * but does not leave Excel open
16 *
17 LOCAL oExcel := Win_OleCreateObject( "Excel.Application" )
18 //LOCAL oExcel := xhb_GetActiveObject( "Excel.Application" )
19 LOCAL oWorkBook, oSheet
20
21 oWorkbook = oExcel:WorkBooks:Open( cXlsName )
22
23 oSheet = oExcel:ActiveSheet
24
25 oSheet:SaveAs( cDbfName, xlDbf3 )
26
27 oWorkBook:Close( False )
28
29 oExcel:Quit()
30 oSheet := NIL
31 oWorkBook := NIL
32 oExcel := NIL
33
34 RETURN( NIL )Não tenho instalado o excell e não gostaria de depender de ter o excell instalado...Tá com o excel instalado né?