LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to open two excel documents using active X calls?

I need to open two existing excel documents and store data using active X. I'm able to open a single excel document. When I try opening two, I get an error stating that it's already opened.

0 Kudos
Message 1 of 7
(2,885 Views)

Hi joeG,

 

Yes, you can open 2 Excel documents using ActiveX calls. It sounds like you are trying to open two references to Excel, but you can use the same Excel reference to open multiple documents. Once you have opened the Excel application reference you can use the Workbooks property to open as many individual workbooks as you would like, and work with them individually. See attached VI, let me know how it works out for you.

 

Thanks

 

Eric

0 Kudos
Message 2 of 7
(2,884 Views)

Thanks Kudos. I will try it out. I am running LabView 8.2.

0 Kudos
Message 3 of 7
(2,881 Views)

No prob, here is the VI in 8.2 (previous one was 8.5).

 

Thanks

 

Eric

0 Kudos
Message 4 of 7
(2,879 Views)

Thanks. That makes sense. How would you open and close sheets in both files?

0 Kudos
Message 5 of 7
(2,861 Views)

Opening a worksheet is done by accessing the Worksheets property of the Workbook reference and, using an invoke node, call the method Item and pass to it the index of the worksheet you want to open. What is returned is a variant, and you need to convert this variant to the Excel._Worksheet class to then work with it as a worksheet. From here you can read, write, etc.

 

Do you have the Report Generation toolkit for Microsoft Office? If you do, it could be a lot easier to work with depending on what you are trying to accomplish... 

 

Eric 

0 Kudos
Message 6 of 7
(2,856 Views)

Thanks Eric. That works fine. One of those files will be used to save data during a script file run. Is it possible to save a file and start a new one everytime I run the script.  Running the script file is part of the overall program. It allows me to save portions of the data.

0 Kudos
Message 7 of 7
(2,838 Views)