LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to get a list of refnums to all ActiveX objects loaded into memory?

Solved!
Go to solution

I specifically want to be able to programmtically save and close an open excel workbook that has not yet been saved and I don't know the name of. From Labview.

I know how to manipulate workbooks that I open from a saved location, but don't know how to take whichever workbook is open on my computer and save it to a known location.

Thanks!

 

I saw this post and thought there might be a similar method for ActiveX objects that there is for vi's:

 

http://forums.ni.com/t5/LabVIEW/Is-it-possible-to-get-a-list-of-refnums-to-all-VIs-loaded-into/td-p/...

 

0 Kudos
Message 1 of 6
(3,769 Views)

The question you want to ask is whether Excel provides a method to list all open documents. See if the Application.Workbooks property gets you what you need.

0 Kudos
Message 2 of 6
(3,753 Views)

If you have the Report Generation Toolkt, the Excel Advanced pallette has a VI called "Excel Get ActiveX References".  It returns the Application, Workbook, Worksheet, Sheets and Shapes. 

aputman
0 Kudos
Message 3 of 6
(3,729 Views)
Solution
Accepted by topic author DaveRines

@DaveRines wrote:

I specifically want to be able to programmtically save and close an open excel workbook that has not yet been saved and I don't know the name of. From Labview.

I know how to manipulate workbooks that I open from a saved location, but don't know how to take whichever workbook is open on my computer and save it to a known location.

Thanks!

 

I saw this post and thought there might be a similar method for ActiveX objects that there is for vi's:

 

http://forums.ni.com/t5/LabVIEW/Is-it-possible-to-get-a-list-of-refnums-to-all-VIs-loaded-into/td-p/...

 


This should work:

 

excel_save_workbooks.png

 

If you want to change the path or have more control on the options, you could replace the '_Workbook/Save' method with

excel_saveas_workbooks.png

In this case, if you want to avoid additional pop-ups, make the 'Visible' and 'DisplayAlerts' properties FALSE when you open the Application in the first ActiveX node

0 Kudos
Message 4 of 6
(3,707 Views)

Thanks for trying, but that's not quite enough info to get me there.  To use that function you still need the report reference which is what I'm looking for.

0 Kudos
Message 5 of 6
(3,659 Views)

This worked.  Here's a slightly tweaked version that worked for me.  Thanks for the help!

0 Kudos
Message 6 of 6
(3,654 Views)