I am trying to use EXCEL via Direct Methed. I can't figure out where I am going wrong with this. Seems to have an issue with the Worksheet Object. This is my first attempt to use the direct method, so I am sure it is me... 
The program crashes with "Excel_PB_Support.exe has encountered a problem and needs to close. We are sorry for the inconvenience."
I have marked where the error occurs in the code. I sent a note to support, but hope to send them an update that it was a programming error (mine) and to disregard. BTW - PBCC50
Thanks for any help you can provide.
Michael
Update: PowerBASIC support states that a bug in EXCEL does not allow use of the Direct Interface.

The program crashes with "Excel_PB_Support.exe has encountered a problem and needs to close. We are sorry for the inconvenience."
I have marked where the error occurs in the code. I sent a note to support, but hope to send them an update that it was a programming error (mine) and to disregard. BTW - PBCC50
Thanks for any help you can provide.
Michael
Update: PowerBASIC support states that a bug in EXCEL does not allow use of the Direct Interface.
Code:
#COMPILE EXE #DEBUG ERROR ON #DIM ALL #REGISTER NONE #TOOLS OFF #INCLUDE "ExcelApp_v2.inc" #IF NOT %DEF(%False) %False = 0& #ENDIF #IF NOT %DEF(%True) %True = NOT %False #ENDIF FUNCTION PBMAIN ' ----------------------------------------------------------------------------- DIM oExcelApp AS Int__Application ' Excel application object DIM oExcelWorkbook AS Int__Workbook ' Excel workbook object DIM oExcelWorksheet AS Int__Worksheet ' Excel worksheet object DIM ExcelSheetsInNewWorkbook AS LONG ' Excel SheetsInNewWorkbook ' ----------------------------------------------------------------------------- ' --------------------------------------------------------------------------- ' - Open a (NEW) instance of Excel - ' --------------------------------------------------------------------------- ' Start Excel oExcelApp = NEWCOM $PROGID_Excel_Application ' Could Excel be opened? If not, terminate this application... IF ISFALSE ISOBJECT(oExcelApp) OR ERR THEN STDOUT "Excel could not be started" SET oExcelApp = NOTHING EXIT FUNCTION ELSE oExcelApp.Visible(0) = %True END IF ' =========================================================================== ' --------------------------------------------------------------------------- ' - Open an Excel Workbook - ' --------------------------------------------------------------------------- ExcelSheetsInNewWorkbook = oExcelApp.SheetsInNewWorkbook(0) oExcelApp.SheetsInNewWorkbook(0) = 1 ' Set SheetsInNewWorkbook to 1 oExcelWorkbook = oExcelApp.WorkBooks.Add IF OBJRESULT OR ERR THEN STDOUT "Could not open Excel workbook" SET oExcelApp = NOTHING SET oExcelWorkbook = NOTHING EXIT FUNCTION ELSE PRINT ACODE$(oExcelWorkBook.Name) END IF oExcelApp.SheetsInNewWorkbook(0) = ExcelSheetsInNewWorkbook ' Restore value ' =========================================================================== oExcelWorkSheet = oExcelWorkBook.ActiveSheet IF ISFALSE ISOBJECT(oExcelWorkSheet) OR ERR THEN STDOUT "Excel WorkSheet object error" EXIT FUNCTION END IF PRINT OBJRESULT PRINT "Worksheet pointer: ";OBJPTR(oExcelWorkSheet) ' This line causes the program to crash...................................... PRINT ACODE$(oExcelWorkSheet.Name) ' ........................................................................... ' oExcelWorkSheet.Activate(1) ' oExcelWorkSheet.Name = "New worksheet name" ' =========================================================================== SET oExcelWorksheet = NOTHING SET oExcelWorkbook = NOTHING SET oExcelApp = NOTHING END FUNCTION
Comment