07-21-2010 01:33 PM
I use Excel Report Instrument to pass data to Excel that I start with ExcelRpt_ApplicationNew. All works fine until I close the Excel manually.
So question is: how can I check from CVI that the Excel application window is not closed?
Solved! Go to Solution.
07-22-2010 04:32 PM
Hello ZVS,
Here is some sample code that you can use to tell in Excel is open. This checks if the process is in Task Manager and returns a negative number if Excel is not open.
#include "excel2000.h"
#include <cvirte.h>
static HRESULT status;
static CAObjHandle handle;
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
status = 0;
status = Excel_ActiveApp (NULL, 1, LOCALE_NEUTRAL, 0, &handle);
CA_DiscardObjHandle (handle);
return 0;
}
You just need to make sure to add the Microsoft Excel Report function panel to your project. You can do this by going to the Instrument menu and selecting Load. It should be located at <National Instruments>\CVI2009\toolslib\activex\excel\excelreport.fp
Have a great day!
Best Regards,
Adam G
07-22-2010 04:39 PM
Thank you!
I tried to find a function in Excel Report tool but this function from Excel 9.0 Object Library. So I have searched in a wrong place.