Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel instantiation and Illegal Operation Error
Message
 
To
04/02/1999 18:01:54
Carol Adler
U.S. Army Kwajalein
Apo, Marshall Islands
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00183729
Message ID:
00184184
Views:
15
Carol,
My app automatically handles the closing because it's part of an automated procedure. In your case, delete the last 3 commands I gave you
OExcel.workbooks(1).close(.t.)
OExcel.quit
Release OExcel
and add
oexcel.visible = .T.
to make it visible to the user.

The user will be in the spreadsheet, and can close it any way he/she wants. I checked this and it works fine. I don't know how to keep them from re-opening Excel, but I'll let you know if I find it.

HTH
Barbara

>I tried this new code, but it doesn't check to see if an instance of Excel is already running. Okay, I'm not a purist so I'll forget about checking, especially since the user has a new 333 running NT.
>
>The "&&Do stuff here" needs to be under total control of the user to format, e-mail, etc. If I add the code to close and quit, the user has no opportunity to do anything.
>
>If I leave out the close and quit, and the user selects File Close instead of Exit, then I get the illegal operation.
>
>Did I leave something out?
>
>
>SET SAFETY OFF
>USE finance_report in 0
>COPY fields except travnbr_b, travnbr_c to c:\temp\text.xls type xls
>SET SAFETY ON
>tmpsheet=getObject('','excel.application')
>oExcel = tmpsheet.application
>oExcel.workbooks.open("c:\temp\text.xls")
>oExcel.visible = .t.
>oExcel.cells.select
>oExcel.selection.columns.autofit
>oExcel.range("A1").select
>
>-- Now the user needs total control of their spreadsheet
>
>Release oExcel
Barbara Paltiel, Paltiel Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform