OLE Errors ==> Developer & Excel

From: Alan Stutchbury <stutch_at_nothanks.com>
Date: Sat, 19 Aug 2000 08:26:00 -0400
Message-ID: <zOun5.842$b05.5095_at_cac1.rdr.news.psi.ca>


I have downloaded the OLE samples from technet. I have got the Word sample working, but I am experiencing problems with the Excel sample.

I am getting a message FRM-305500 when the code attempts to return an object handle to the Workbooks collection (statement #3)

BEGIN

  • Start Excel and make it visible application:=OLE2.CREATE_OBJ('Excel.Application'); OLE2.SET_PROPERTY(application, 'Visible', 'True');
  • Return object handle to the Workbooks collection workbooks:=OLE2.INVOKE_OBJ(application, 'Workbooks');
  • Add a new Workbook object to the Workbooks collection workbook:=OLE2.INVOKE_OBJ(workbooks,'Add');
  • Return object handle to the Worksheets collection for the
  • Workbook worksheets:=OLE2.INVOKE_OBJ(workbook, 'Worksheets');
  • Add a new Worksheet to the Worksheets collection worksheet:=OLE2.INVOKE_OBJ(worksheets,'Add');
  • Return object handle to cell A1 on the new Worksheet args:=OLE2.CREATE_ARGLIST; OLE2.ADD_ARG(args, 1); OLE2.ADD_ARG(args, 1); cell:=OLE2.INVOKE_OBJ(worksheet, 'Cells', args); OLE2.DESTROY_ARGLIST(args);
  • Set the contents of the cell to 'Hello Excel!' OLE2.SET_PROPERTY(cell, 'Value', 'Hello Excel!');
  • Release the OLE objects OLE2.RELEASE_OBJ(cell); OLE2.RELEASE_OBJ(worksheet); OLE2.RELEASE_OBJ(worksheets); OLE2.RELEASE_OBJ(workbook); OLE2.RELEASE_OBJ(workbooks); OLE2.RELEASE_OBJ(application); END;
Received on Sat Aug 19 2000 - 14:26:00 CEST

Original text of this message