DC_Excel2Array with MS Excel 2013

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
unixkd
Posts: 579
Joined: Thu Feb 11, 2010 1:39 pm

DC_Excel2Array with MS Excel 2013

#1 Post by unixkd »

Hi Roger

DC_Excel2Array() function give error in the line indicated below while using Excel 2013 work fine with Excel 2010

FUNCTION DC_Excel2Array( cExcelFile, bEval )

LOCAL oExcel, oBook, aValues

#if XPPVER > 1900000
// Create the "Excel.Application" object
oExcel := CreateObject("Excel.Application")
IF Empty( oExcel )
DC_WinAlert( "Excel is not installed" )
RETURN nil
ENDIF
#else
DC_WinAlert('This feature is available in Xbase++ 1.9 and later only!')
RETURN nil
#endif

oExcel:Visible := .f.

// Load a Workbook from an .XLS file

IF !FExists(cExcelFile)
DC_WinAlert( 'File does not exist:' + Chr(13) + cExcelFile )
RETURN nil
ENDIF

oBook := oExcel:Workbooks:Open(cExcelFile) /// ************** GIVE ERROR HERE ****************************************************

IF Valtype(bEval) == 'B'
Eval( bEval, oExcel, oBook )
ENDIF

aValues := oBook:workSheets(1):usedRange:value

oBook:close()
oBook:destroy()

// Quit Excel
oExcel:Quit()
oExcel:Destroy()

RETURN aValues

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DC_Excel2Array with MS Excel 2013

#2 Post by rdonnay »

What is the error?
The eXpress train is coming - and it has more cars.

User avatar
unixkd
Posts: 579
Joined: Thu Feb 11, 2010 1:39 pm

Re: DC_Excel2Array with MS Excel 2013

#3 Post by unixkd »

Excel2Array.png
Excel2Array.png (368.72 KiB) Viewed 7379 times

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DC_Excel2Array with MS Excel 2013

#4 Post by rdonnay »

This is what I found in a Google search:
Re: "Server Threw an Exception" Error When Creating an Excel File
Nov 09, 2008 07:03 PM|LINK

I had a similar issue a couple of years ago and I solved the issue by installing Excel on the server. I don't do much work with Excel so maybe there is an easier way, possibly just adding the correct dlls. But when I hear "it worked on my machine but not the server" I can only assume the only thing the server doesn't have that ur machine has is Excel, and that's what fixed my issue. Give it a shot unless you find a better solution and if you do please post the answer for others.
Correct Answer
by Andrew Workman on May 2, 2013 8:13 AM
OK, found the solution. It was the .net framework. 3.0 is the minimum requirement for EPDM to function. However, there is something int he 3.... framework that is NOT included in the 4.... framework. So it is not completely backwards compatible. a 4.0 framework install will not cover all frameworks before it. We installed 3.5 on her machine, and it functions perfectly now. so, if anyone else has a similar issue, make sure you have some version of 3.... framework installed.
The eXpress train is coming - and it has more cars.

User avatar
unixkd
Posts: 579
Joined: Thu Feb 11, 2010 1:39 pm

Re: DC_Excel2Array with MS Excel 2013

#5 Post by unixkd »

Thanks.

I will try some options

Post Reply