Libary call

Previous topic - Next topic

Robert

I want to open an excelfile with a call to a function that is declared like this: DECLARE(ExcelOpen, DLL, (const char* szBook), int). I don't know C but I tried to place the excelfile in the same map as the app and just called with: XLS_Open("t.xlsx") but it doesn't work. Its a program in the Showroom/page 7/Excel interface.

MrTAToad

Have you tried putting the excel file in the media directory ?

Robert

Yes.
Code (glbasic) Select
XLS_Init(TRUE) // Yes, show excel

//XLS_NewWorkBook()

XLS_Open("t.xlsx")
XLS_SetActiveSheet(2)
XLS_SetCell(1,1, "5")
XLS_SetCell(1,2, "10")
XLS_SetCell(1,3, "=" + XLS_CellName$(1,1) + "+" + XLS_CellName$(1,2))

LOCAL string$
XLS_GetCell(1,3, string$)

STDOUT "reading: "+string$+"\n"


KEYWAIT

XLS_Quit()


Either it open a new file or, if I try to open on the first line, I get "NULL passed to autowrap"

kanonet

Did you try an old .xls? I dont think that old code supports the more modern .xlsx, if it still runs at all...
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Robert

It can be so but I want to manipulate new files so install an old version is not an alternativ. Interesting though that it is possible to do.

kanonet

New version of MS Office usually can also save to old file format. May be worth to at least try it.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Robert

I tried saving as 2003 xls but can't get it to work. Think I give up, but thanks anyway.

Qedo

work in:
c:\users\<your user name>\documents\t.xls

Ciao

Robert

I tried to put that in as a string but i got syntax error. The compiler seems to not accept absolut adresses in a string.

Qedo

Try:

address$="D:\\APPOGGIO\\Basic\\glbasic10\\code\\GLBasic\\Excel\\t.xls"

XLS_Open(address$)

Robert

Thanks a lot, it works.

Strange that you can't put a single "\" in a string.

Kitty Hello

The \ is an escape character. You have to \\ to escape a single \.