General information
Title:
Excel instantiation and Illegal Operation Error
I wanted to check to see if an instance of Excel was already running ,and if so, don't open a new one, but open the document. If not, then open a new instance of Excel.
I have it figured out in Word, but not in Excel.
------------------
Next problem: VFP(5.0a) takes the data from the view (finance_report) and dumps it into the file text.xls, opens Excel, selects all, autofits the columns, and places the selection in cell A1.
The user will then "Send" the document. If I Exit out of Excel, everything is great and I'm returned to VFP. However, if I close the document, I am returned to VFP with an 'illegal operation' error from Excel.
How do I handle this?
-----------------------------
Here's my code:
USE finance_report in 0
copy fields except travnbr_b,travnbr_c to c:\temp\text.xls type xls
IF TYPE("oExcel") != "O"
PUBLIC oExcel
oExcel=createobject("Excel.Application")
ENDIF
oExcel.Workbooks.Open("C:\Temp\text.xls")
oExcel.visible = .t.
oExcel.cells.select
oExcel.selection.columns.autofit
oExcel.range("A1").select
Release oExcel
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only