LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is EXCEL Search and Replace supported with LabWindows?

Does CVI support search and replace in an Excel file? I noticed that LabView does.

V9.0

 

Thanks.

0 Kudos
Message 1 of 9
(4,771 Views)

Hi NI Nubie,

 

CVI can interact with Excel via ActiveX.  You have the option to use the Microsoft Excel Object Library, which houses all the functions that Microsoft chooses to expose.  I would recommend using the ActiveX Controller Wizard to get access to this Library and then use the appropriate functions.

 

Also, there are a few examples that ship with CVI about interacting with Excel.  You can find these under <CVI90>\samples\activex\excel.

Cheers,
Kelly R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 9
(4,729 Views)

The answer is yes.  The functions to use are:

Excel_WorksheetFunctionFind(....) and Excel_WorksheetFunctionReplace(....)

defined in the excel2000.fp shipped with LabWindows/CVI.

0 Kudos
Message 3 of 9
(4,727 Views)

I cannot find the two functions you mentioned.

 

This is what I did:

Tools-->Create ActiveX controller-->ActiveX Server: Microsoft Excel 12.0 Object Library

Instrument Prefix: Excel

Target .fp File: excel200.fp

Add .fp File to Project

Compatibility Options: Per Property

As Automation Server Objects

Advanced Options: Selected everything because it did not work with just selecting Worksheet

 

I am not sure if this should be a server?

 

It compiles and generates everything including the kitchen sink but I cannot see the 'Find' or 'Replace' calls?

0 Kudos
Message 4 of 9
(4,706 Views)

Hi!

 

You don't need to re-create the Active X server functions.  The sample files "excel2000.c"

"excel2000.fp" and "excel2000.h" are included under your CVI installation folder "samples".

Just include these files into your project and you can use those functions right away.

0 Kudos
Message 5 of 9
(4,700 Views)

Hi.

 

I just added the files now I need to find out the details for the call parameters (objectHandle, &errorInfo, &arg1, &arg2, arg3, &returnValue).

Where can I find these?

I checked 'Help' and ni.com with no luck.

 

Excel_WorksheetFunctionFind (objectHandle, &errorInfo, &arg1, &arg2, arg3, &returnValue);

 

I assume objectHandle somehow relates to the excel fileHandle?

 

Thanks.

0 Kudos
Message 6 of 9
(4,697 Views)

I found out that NI does not have any help on the Excel stuff.

I am looking for the formal definition of these functions?

 

This is required:

1. Find token string: char R5_15[] = "R5.15_Voltage";

2. Replace token string with result string: char R5_15_RES[RESULT_SIZE] = "some test result";

 

There will only be one worksheet.

 

Do you know the definitions of arg1,2, &3?

Excel_WorksheetFunctionFind (CAObjHandle objectHandle,
                                               ERRORINFO
*errorInfo,
                                                           const char *arg1, const char *arg2,
                                               VARIANT arg3,
double *returnValue);

 

 

 

Do you know the definitions of arg1,2,3,4 and returnValue?

 

Excel_WorksheetFunctionReplace (CAObjHandle objectHandle,
                                                    ERRORINFO *errorInfo,
                                                    const char *arg1, double arg2,
                                                    double arg3, const char *arg4,
                                                    char **returnValue);

0 Kudos
Message 7 of 9
(4,689 Views)

These links may be helpful for clearing up the definitions of the two functions:

 

Find function: http://msdn.microsoft.com/en-us/library/bb179184.aspx

Replace function:  http://msdn.microsoft.com/en-us/library/bb179194.aspx

Cheers,
Kelly R.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 9
(4,671 Views)

Hello everybody,

 

I have an application which runs on Labwindows CVI and uses microsoft Excel 8.0 Object Library in order to write datas in a Excel document. I used Excel 2003. A picture is inserted and is redimensionned at the top af the .xls file. With Excel 2003, there are no problems.

But I recently installed Excel 2007. The picture is rightly inserted, but after I have an activex automation error message saying than the proprties of picture cannot be modified.

Fisrt, I tried to reference the microsoft excel 8.0 object library under VBA in Excel 2007, but I didn't find the way.

Second, I modified my application in order to use the microsoft Excel 9.0 Object Library (present in folder samples -> activex -> Excel). I saw that the object picture is not defined anymore in this library. Is there an equivalent way to manage my picture? Is it the good way to solve my problem or it is necessary to use microsoft Excel 12.0 object library for Excel 2007? (but it is no present in folder samples -> activex -> Excel)

 

Can somebody Help me?

Thanks a lot

 

 

0 Kudos
Message 9 of 9
(4,546 Views)