LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to close an Excel workbook when reference unknown?

Hi,

I'm trying to write code in LabVIEW 7.0 to do the following with an Excel 2002 workbook:

1. Check to see if a workbook is already open in Excel when all that is known is the name of the workbook
1a. If the workbook is open, close it.
2. Write information to the workbook that was just closed.
3. Open the workbook again in Excel.

I am able to do steps 2 & 3 and step 1 works fine if the workbook is only open in an instance of the Excel that the software created and no other workbooks have been opened by the software. However, if multiple workbooks have been opened by the software and this workbook is no longer the top-most workbook or if the workbook has been manually opened by the user and it's not the top-most workbook I'm unable to find a way to close the workbook.

I had downloaded the Excel Toolkit lv6i from ni.com that Martin Vernhout had written. In this there is a vi in _specials.llb called "close XL workbook by name.vi" which should do exactly what I want, but the subvi, "excel objectRepository.vi" is not returning any references when, in fact, there are open instances of Excel. This vi's block diagram is locked, so I can't look at it to see what the problem is. I tried emailing him using the email address that was included with the documentation, but it's no longer a valid email address.

Does anyone know how I can accomplish this task in LabVIEW?!

Thanks!!!

JesseB
0 Kudos
Message 1 of 2
(2,717 Views)
please see the attached gif image
0 Kudos
Message 2 of 2
(2,705 Views)