I have my exe that makes a file excel...
- Code: Select all Expand view RUN
oExcel := CREATEOBJECT( "Excel.Application" )
oBook := oExcel:Workbooks()
oWorkBook := oExcel:Workbooks:Add()
oWorkBook:Sheets("Foglio1"):Select()
oWorkBook:Sheets("Foglio1"):Name := "Dati"
...
then I save this file and export to pdf...
- Code: Select all Expand view RUN
oExcel:WorkSheets(1):PageSetup:PrintTitleRows := "$1:$2"
oExcel:WorkSheets(1):PageSetup:CenterFooter := "Pagina &P di &N"
oExcel:WorkSheets(1):PageSetup:Orientation := 2
oExcel:WorkSheets(1):PageSetup:PaperSize := 9
oExcel:WorkSheets(1):PageSetup:Zoom := .f.
oExcel:WorkSheets(1):PageSetup:FitToPagesWide := 1
oExcel:WorkSheets(1):PageSetup:FitToPagesTall := .f.
oExcel:WorkSheets(1):ExportAsFixedFormat( xlTypePDF,cFilePDF)
oWorkBook:SaveAs(Filename:=cFileMail, FileFormat:=52)
this exe is on a server and Windows Task scheduler run this exe every night (02.00).
when I run this exe by my double click mouse that works fine but when it run by Windows Task scheduler I get this error:
Application
===========
Path and name: C:\batchDcasta\LAVCEN.EXE (64 bits)
Size: 5,244,928 bytes
Compiler version: Harbour 3.2.0dev (r1904111533)
FiveWin version: FWH 19.06
C compiler version: Microsoft Visual C++ 19.20.27508 (64-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 25 secs
Error occurred at: 05-07-2023, 06:00:35
Error description: (DOS Error -2147352567) WINOLE/1006 Unable to set the PaperSize property for the PageSetup class. (0x800A03EC): Microsoft Excel
Args:
[ 1] = N 9
Stack Calls
===========
Called from: => TOLEAUTO:_PAPERSIZE( 0 )
Called from: lavcen.prg => MAIN( 657 )
any solution?
thanks