Hola,¿ como puedo abrir y modificar un archivo xls, xlsx y xlsm ?
En una hoja especifica o en una hoja única
Gracias, Saludos
Arhivos xls y xlsm
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Arhivos xls y xlsm
It is much simpler using the FWH builtin function
GetExcelBook( cFileFullPath ) --> oBook
You can also opt for full code like this:
We recommend the first approach.
GetExcelBook( cFileFullPath ) --> oBook
Code: Select all
if ( oBook := GetExcelBook( cExcelFileNameWithFullPath ) ) != nil
oBook:Application:Visible := .t.
endif
Code: Select all
function OpenExcelBook()
local cExcelFile := "import.xlsx"
local oExcel, oBook, lOpened := .f.
if File( cExcelFile )
cExcelFile := TrueName( cExcelFile ) // add full path
CursorWait()
if ( oExcel := ExcelObj() ) != nil
TRY
oBook := oExcel:WorkBooks:Open( cExcelFile )
lOpened := .t.
CATCH
END
if lOpened
oExcel:Visible := .t.
else
? "Can not open " + cExcelFile
endif
else
? "Excel not installed"
endif
else
? cExcelFile + " not found"
endif
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India