I have a FoxPro 7.x application that creates Excel files to hold report output. It uses the standard
oExcel = CREATEOBJECT("Excel.Application")
to instantiate the object, then creates new worksheets, populates them, formats them, etc. using standard Excel automation functions. This is all working fine. Some of these reports are rather lengthy and it can take several minutes to generate the Excel file. During this time, if the user goes to Windows Explorer and double-clicks another Excel file, Windows sends it to the same Excel instance that my FoxPro application is using. Again, this is fine so far. But then if the user closes the entire Excel application rather than closing just the newly opened workbook, it generates an error as follows:
OLE Error Code 0X800A01A8: Unknown COM Status Code
System Error #1426
Is there a way to prevent this from happening? Is there some setting I can use when I create the Excel object that tells it not to accept other workbooks? Or is there some command I can issue that would tell Windows to always open another Excel instance rather than sending the workbook to the most recently opened Excel instance?
Yes, I know I could tell my users to always open Excel from the Windows start menu while they are working with my program, but users have a tendency to forget.
Thank you in advance!
Dale Beitz
Michigan Health & Hospital Association