I try the following code, but no file (even the sample file "demo.xslx" coming with LibXL) can be opened.
Resulting error message: "can't open file for reading".. But: the file is not write protected or in use
That's my code (tested with PB 5.72 and PB.562, current version 3.9.0.0 of LibXL):
TIA..
Code: Select all
ImportC "libxl.lib"
xlCreateBookW.i()
xlBookReleaseW.i(book.i)
xlBookAddSheetW.i(book.i,sheet.s,flag.i)
xlBookSaveW.i(book.i,save.s)
xlBookLoadW(book.i,filename.p-ascii)
xlBooksetActiveSheetW(book.i,index.i)
xlBookActiveSheetW(book.i)
xlSheetWriteStrW.i(sheet.i,x.i,y.i,string.s,flag.i)
xlSheetWriteNumW.i(sheet.i,x.i,y.i,value.i,flag.i)
xlBookSheetCountW(book.i)
xlBookErrorMessageW.i(book.i)
EndImport
Global book.i
Global sheet.i
Define bret.i
book = xlCreateBookW()
Debug PeekS(xlBookErrorMessageW(book),-1,#PB_Ascii)
sfn$="demo.xlsx"
If book
bret=xlBookLoadW(book,sfn$)
If bret=0
Debug PeekS(xlBookErrorMessageW(book),-1,#PB_Ascii)
; -> results in "can't open file for reading".
Else
Debug "Sheets:"+Str(xlBookSheetCountW(book))
EndIf
xlBookReleaseW(book)
EndIf


