The file is opened by my BB4W program, using COMLIB, which reads it every 10 min after Excel has done a new download of the webdata (also every 10 min, but there is no need to be in sync)
All this behaves as described above if I do this manually. However it does not work from the BB4W code : the Excel file reads the data that are already present (from a previous session) but doesn’t download any new data from the website. No error messages are produced.
The following code is merely for the purpose of illustrating how I've gone about. The code has been tested and shows the content of cell(109,1). This cell should show a new value every 10 min but always stays the same.
Code: Select all
INSTALL @lib$+"COMLIB":INSTALL @lib$+"NOWAIT" Invest$="F:\DOCU_NEW\BEURS\Experiment1.xlsx" Invest=OPENUP(Invest$):CLOSE#0:IF Invest=0 PRINT "File not available":END PROC_cominit:ON ERROR PROC_Cleanup Xap=FN_createobject("Excel.Application") Inv=FN_getobject(Xap,"Workbooks.Open("""+Invest$+""")") Stl=FN_getobject(Inv,"WorkSheets(1)") FOR z=1 TO 50 PROCwait(60000) testvalue$=FN_getvaluestr(Stl,"cells(109,1).value") PRINT testvalue$ NEXT z PROC_Cleanup END DEFPROC_Cleanup Stl+=0:IF Stl PROC_releaseobject(Stl):Stl=0 Inv+=0:IF Inv PROC_callmethod(Inv,"Close(B FALSE)"):PROC_releaseobject(Inv):Inv=0 Xap+=0:IF Xap PROC_callmethod(Xap,"Quit"):PROC_releaseobject(Xap):Xap=0 PROC_comexit ENDPROC
… unless someone can advise me how to control this correctly from BB4W with COMLIB ?
Any ideas someone ?