LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX Automation RefNum, Lost accross VI's

(Ref LV 5.1.1)

I'm using an Excel._Application RefNum to a Automation Open and then to a Property Node with method "Visible" set to False, the RefNum from the node is wired to a Global Automation RefNum.
The above code resides within a case of a multi case state machine.
Once the VI starts running, and the above case executes, Excel opens (in background).

Later, in a different state I wire the Global Refnum to a Property Node with method "Quit" and the Node wired to an Automation Close.
When this state executes, Excel closes BUT the error out of the Property Node indicates Code 1, invalid function.

Further expantion of the above to open a WorkBook, then a Sheet appears to succeed untill an attempt to write (or rea
d) a cell. Same error as above (1, invalid function)

Any ideas...
Thanks
Nicos
0 Kudos
Message 1 of 3
(2,893 Views)
Hi Nicos,

You need to be careful to close all child Refnums in proper order. If you open Excel.Workbook.Range, then the ActiveX refnum for the "Range" must be closed first, then for "Workbook" and then you can close "Excel" properly. This can be annoying, but is very important.

If you are trying to close Excel without all child refnums closed, Excel will remain visible in the task manager. Have a look and see.

Hope this helps,

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 3
(2,893 Views)
Hi Shane,

Thanks for the info.
I thing that my q. was not clear enough.
At this stage the only RefNum is the Excel.Application.
If I add WorkBook RefNum, then the error appears after I close the WorkBook RefNum.
Any further ideas ?
Nicos
0 Kudos
Message 3 of 3
(2,893 Views)