Have you tried this approach? :
** Excel method in a form
if upper(vartype(this.oExcel)) = "O"
this.oExcel.quit
this.oExcel = .f.
Else
this.AddProperty('oExcel')
EndIf
if upper(vartype(this.oExcel)) <> "O"
this.oExcel=createobject("Excel.Application")
else
this.oExcel=getobject(,"Excel.Application")
endif
The last 5 lines are suggested by Tranor / Martin in their book 'Microsoft
Office Automation with VFP'. Also, look at the help for GETOBJECT.
FYI, users everywhere always have Excel open, so with some versions of VFP
this is a problem. With the above code, Excel does not bomb. If it does, the
first 6 lines of code kill the instance that lurks in memory, that is not
seen but that creates havoc in your system.
My experience, anyway
Rafael Copquin
www.copquin.com.ar
Universal Thread Magazine - Translation Coordinator
Treasurer - Microsoft Users Group of Argentina (MUG)
www.mug.org.ar
----- Original Message -----
From: "Chris Davis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 24, 2006 12:02 AM
Subject: Excel Automation Problem
> Hi All,
>
> I have an application which while it is running holds open an instance of
> Excel. This causes a problem when outside of my application the user
> double
> clicks on a spreadsheet as it brings the instance of Excel I have in
> memory
> to the front and loads the double clicked spreadsheet in it. I have
> initially got around this by changing the way the file association
> launches
> Excel so that each spreadsheet is launched in its own instance of Excel.
> Although that is a reasonable solution it still presents a few problems
> which I wont go into here.
>
> I was just wondering if it was possible to say duplicate EXCEL.EXE to
> EXCEL2.EXE and somehow register that in the registry so that I could do
> something like createobject(myexcel.application) which would launch
> EXCEL2.EXE instead of EXCEL.EXE leaving EXCEL.EXE to do what it wants to
> do.
>
> Any suggestions, the one commemt I don't need is why have I got excel open
> all the time my application is running, this is one thing which I am
> unable
> to change and won't bore you with.
>
> Cheers
>
> Chris.
>
>
>
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.