Microsoft
Software
Hardware
Network
Question : Foxpro and using Excel 2010 as an object
Part of my main Foxpro program converts Excel files to Excel 97/95 to be appended later on in other parts of the program. Here is my conversion code:
PROCEDURE excelconv
oExcel = CREATEOBJECT("Excel.Applic
ation")
xlworkbook = oExcel.Workbooks.Open(ALLT
RIM(insert
_config.lo
cation)+"\
"+m_file)
xlworkbook.SaveAs(ALLTRIM(
insert_con
fig.locati
on)+"\"+LE
FT(ALLTRIM
(m_file),L
EN(ALLTRIM
(m_file))-
4)+".xls",
43)
*RELEASE oExcel
xlworkbook.saved = .t.
xlworkbook.close
oExcel.quit
RETURN
This has worked for clients that have 2003 and 2007 Excel.
I just upgraded to 2010 and was runing a test and got this error on the "saveas" line:
OLE IDispatch exception code 0 from Microsoft Excel: Unable to get the SaveAs property of the workbook class..
I attempted to change the file format to -4143 instead on 43. The program processed the SaveAs OK, but the file gave me an "Invalid Microsoft Excel File format" when I attempted to append.
I appreciate your help on this. Thanks
Answer : Foxpro and using Excel 2010 as an object
Perhaps try xlExcel9795 instead of 43..
Random Solutions
HTML Form w/js input validation
Inserting an action inside a Node with xPath
Windows 7 domain User cannot connect to outlook-exchange
new static IP coming next friday with move. advice please
Usin SSMS how do I add a unique ID field?
Exporting kernel memory to user space using devmap_umem_setup
extracting rows from a sheet to a sheet
sql server 2000 @@ERROR variable wrong result
Cannot access voicemail on Exchange 2010 from OCS 2007R2. Failure Type 80004005
Insert Item to ContextMenuStrip ?