AnsweredAssumed Answered

vrf loose control over Excel Application

Question asked by VRFuser on May 20, 2004
Hello Torsten

There was a recent post which states that Excel will stop handling calls to
it's ActiveX methods when a cell is being edited.  I guess this means if a
cursor is blinking in the cell or something like that.  I think this applies
to you but not sure.

Also be careful to release (delete) Object Reference variables and not to
have then on the data lines between objects, or data outputs.  These object
references prevent excel objects unloading.  I.e. you may close Excel but
some of it's internals will still be lingering, which causes problems when
re-opening Excel.

Regards

Andrew Fudge
Genesys IBS
Wales, UK

----- Original Message -----
From: <Torsten.Bilz@nokia.com>
To: "VRF" <vrf@agilent.com>
Sent: Friday, May 21, 2004 11:32 AM
Subject: [vrf] loose control over Excel Application


Hello everybody,

I've got the following problem and I hope somebody can help me:

I want to control an Excel application out of Vee using ActiveX.
I create the application (set my global variable "App", which points to
ExcelApplication), make it visible and open an existing Excel file (set my
global variable "Book", which points to the workbook). After that I display
a Vee "Save" button to prevent Vee from going any further in its program
flow. The user is supposed to enter data into the Excel sheet and press the
"Save" button afterwards and then Vee is going to save the Excel Workbook
and close/quit Excel.
As long as the user doesn't enter any data it works perfectly. But as soon
as he does, I loose control over the Application/Workbook. That means my
global Vee variables (Book, App), still point to the same address, but the
type/object info is set to "null" (if I look at App for instance, it gives
me something like: "(null)(0x0021f914)") and if I attempt to access the
"SaveAs" method of "Book" then I get the error message: "SaveAs" is not a
member of the referenced ActiveX object".

I'm using Vee 6.01, Excel 2000 and the Microsoft Excel 9.0 Object Library
and I have the following code:

In a formula with input "filename":
set App=CreateObject("Excel.Application");
App.Visible=True;
App.Workbooks.Open(filename);
set Book=App.ActiveWorkbook;

The I call the "Save" button

In a formula with input "filename":
Book.SaveAs(filename);
App.Quit();

Thanks for the help.

Kind Regards
Torsten

---
You are currently subscribed to vrf as: AndrewF@genesysibs.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@agilent.com".
If you need help with the mailing list send a message to
"owner-vrf@it.lists.it.agilent.com".


---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@agilent.com". 
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".

Outcomes