The following code works in our NET EXPRESS code...
$set ooctrl( P)
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
******************************************************************
class-control.
MSExcel is class "$OLE$Excel.Application".
******************************************************************
Procedure Division
*> Create a new instance of Microsoft Excel
invoke MSExcel "new" returning ExcelObject.
*> Make Excel visible
* invoke ExcelObject "setVisible" using by value 1.
*> Get the collection of WorkBooks
invoke ExcelObject "getWorkBooks"
returning WorkBooksCollection.
*> Open File
invoke WorkBooksCollection "Open"
using by reference WS-CSVFILE
returning Workbook.
invoke Workbook "getWorkSheets" returning WorkSheets.
invoke WorkSheets "getItem" using by value 1
returning WorkSheet.
* Get rid of the embedded formulae by copying the first 256
* columns and then doing a paste special
invoke WorkSheet "getColumns" using z"A:IV"
returning theRange.
invoke theRange "Select".
invoke theRange "Copy".
invoke theRange "PasteSpecial" using
by value -4163
by value -4142.
invoke theRange "Autofit".
invoke theRange "finalize" returning theRange.
invoke WorkSheet "getRange" using z"A1:A1"
returning theRange.
invoke theRange "Select".
MOVE SPACES TO WS-PASSWORD.
IF REP-PASSWORD(1) NOT= SPACES
PERFORM GET-PASSWORD.
STRING WS-PASSWORD DELIMITED BY SPACE, x"00",
INTO WS-PASSWORD.
SET XLEXCEL7 OF ExcelFileFormat TO TRUE.
invoke WorkSheet "SaveAs" using
by reference WS-XLSFILE
by value ExcelFileFormat
by reference WS-PASSWORD.
invoke WorkSheet "finalize" returning Worksheet.
invoke WorkSheets "finalize" returning WorkSheets.
invoke Workbook "finalize" returning WorkBook.
invoke WorkbooksCollection "finalize"
returning WorkBooksCollection.
invoke ExcelObject "Quit".
invoke ExcelObject "finalize" returning ExcelObject.
STRING WS-MESSAGE-STR, " file " WS-FILENAME,
" created successfully" DELIMITED BY " " INTO
WS-MESSAGE-STR.
When this code is inserted in managed .NET code we get an COBCH0845 error "Unknown Class - "$OLE$Excel.Application" and then a load more errors relating to the various lines of code above.
How do we get managed .NET code to allow us to work with EXCEL?




