Excel Save Problem
Posted: Wed Feb 01, 2012 8:53 am
Roger,
I have asked this on a prior log, but still having same problem.
We have export to excel with a save as, specific file name. Check for file existing, try to erase, and if failing, we assign a random file name. Users are still getting save errors constantly. We get logs from users daily on this. Test here and it works if we leave the file open and it assigns the random name.
Here is the snippet of code:
if file(newname)
if ferase(newname)=-1
else
//give it a temp file name
store 'XX'+STRZERO(round(dc_random(),0),3)+ STRZERO(round(dc_random(),0),3)+'.xls' to newname
endif
endif
if !empty(newname)
oBook:SaveAs( newname , xlWorkbookNormal )
endif
***end of code
Here is the error message. Always the same, except for the filename, which depends on which program/file/report is being exported.
oError:args :
-> VALTYPE: C VALUE: SaveAs
-> VALTYPE: C VALUE: Z:\oiswin\download\payrev.xls
-> VALTYPE: N VALUE: -4143
oError:description : Cannot access 'payrev.xls'.
oError:filename : NIL
oErro:genCode : NIL
oError:operation : SaveAs
CALLSTACK:
Called from AUTOMATIONOBJECT:ONERROR(1037) Called from ASCOMERROR:RAISE(308) Called from ASCOMERROR:RAISEERROR(505) Called from ASCOMERROR:RAISEONERROR(530) Called from AUTOMATIONOBJECT:NOMETHOD(957) Called from EXCEL1(89) Called from PRINTREADY(1013) Called from PRTPAYRV(440) Called from (B)MAIN(1318) WORKAREA STATUS:
***end of error log.
The path is fine. and the next time it works, or maybe the time after that( we may see 2 errors, but rarely more than that)
Any help is appreciated.
Fred
Omni
I have asked this on a prior log, but still having same problem.
We have export to excel with a save as, specific file name. Check for file existing, try to erase, and if failing, we assign a random file name. Users are still getting save errors constantly. We get logs from users daily on this. Test here and it works if we leave the file open and it assigns the random name.
Here is the snippet of code:
if file(newname)
if ferase(newname)=-1
else
//give it a temp file name
store 'XX'+STRZERO(round(dc_random(),0),3)+ STRZERO(round(dc_random(),0),3)+'.xls' to newname
endif
endif
if !empty(newname)
oBook:SaveAs( newname , xlWorkbookNormal )
endif
***end of code
Here is the error message. Always the same, except for the filename, which depends on which program/file/report is being exported.
oError:args :
-> VALTYPE: C VALUE: SaveAs
-> VALTYPE: C VALUE: Z:\oiswin\download\payrev.xls
-> VALTYPE: N VALUE: -4143
oError:description : Cannot access 'payrev.xls'.
oError:filename : NIL
oErro:genCode : NIL
oError:operation : SaveAs
CALLSTACK:
Called from AUTOMATIONOBJECT:ONERROR(1037) Called from ASCOMERROR:RAISE(308) Called from ASCOMERROR:RAISEERROR(505) Called from ASCOMERROR:RAISEONERROR(530) Called from AUTOMATIONOBJECT:NOMETHOD(957) Called from EXCEL1(89) Called from PRINTREADY(1013) Called from PRTPAYRV(440) Called from (B)MAIN(1318) WORKAREA STATUS:
***end of error log.
The path is fine. and the next time it works, or maybe the time after that( we may see 2 errors, but rarely more than that)
Any help is appreciated.
Fred
Omni