Hello,
I am trying to create an automated XLS report and e-mail from FWH (18.02) . However, when I use SAVEAS, I get the following error. I have provided code and hope someone can assist.
I am getting error from Windows 10 and Windows Server 2012
Application
===========
Path and name: C:\web\cofc\5day.exe (32 bits)
Size: 3,891,200 bytes
Compiler version: Harbour 3.2.0dev (r1801051438)
FiveWin version: FWH 18.02
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 07/05/2018, 01:47:24
Error description: Error BASE/1004 No exported method: SAVEAS
Args:
[ 1] = U
[ 2] = C c:\apps\reports\999720180705014724.XLS
****************************
Source Code:
TRY
oExcel := GetActiveObject( "Excel.Application" )
CATCH
TRY
oExcel := CreateObject( "Excel.Application" )
CATCH
RETURN
END
END
nPage := 1
nRow := 1
oBook := oExcel:WorkBooks:Add()
oAS := oBook:Worksheets(1)
oAs:Name := 'REPORT'
oAS:Cells:Font:Name := "Arial"
oAS:Cells:Font:Size := 10
oAs:PageSetup:PrintGridLines := .F.
oAs:PageSetup:Orientation := 2
oAs:PageSetup:LeftMargin := .50
oAs:PageSetup:RightMargin := .50
oAs:PageSetup:TopMargin := .50
oAs:PageSetup:BottomMargin := .50
oAs:PageSetup:FitToPagesWide := 1
oAs:PageSetup:FitToPagesTall := .F.
oAs:Columns(01):ColumnWidth = 10 //
nRow := 1
oAs:Cells (nRow, 1):Font:Bold := .T.
oAs:Cells (nRow, 1):Font:Size := 12
oAs:Cells (nRow, 1):Value := 'TEST'
nRow++
oAs:Cells (nRow, 1):Font:Bold := .T.
oAs:Cells (nRow, 1):Font:Size := 12
oAs:Cells (nRow, 1):Value := 'Test Report'
nRow++
oAs:Cells (nRow, 1):Font:Bold := .T.
oAs:Cells (nRow, 1):Font:Size := 12
oAs:Cells (nRow, 1):Value := CHR(39) + 'Report Date = ' + DTOC( DATE() ) + ' @ ' + LEFT( TIME(), 5 )
nRow++
nRow++
// Header...
oAs:Cells (nRow, 1):Value := 'data col1.'
oAs:Cells(nRow, 1 ):Select()
nRow++
lFirst := .F.
ENDIF
// Write to XLS
oAs:Cells (nRow, 1):Value := CHR(39) + ALLTRIM( ctnrreq->reqno ) + IF(ctnrreq->cancel,"*","")
nRow++
// Counter....
nKey++
SELECT ctnrreq
SKIP
ENDDO
cCsvname := ALLTRIM( customer->recorid ) + DTOS(DATE()) + LEFT(TIME(),2)+SUBSTR(TIME(),4,2)+RIGHT(TIME(),2) + ".XLSX"
oBook:SaveAs( cRoot + cCsvname )
oExcel:Quit()