LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Removing Autofilter and Unfreezing Panes in Excel sheet with the help of CVI function

Hi,

  I am using Lab windows CVI. Which function should be used for removing Autofilter and Unfreezing Panes in Excel sheet.

Thanks & Regards,

Rajesh

0 Kudos
Message 1 of 6
(4,172 Views)

Hi Rajesh,

 

The function that does this is most likely going to be "Set Property" in the Excel Report Instrument, see here. Add the .fp files at that location and you can browse the different functions and attributes that those functions control.

With warm regards,

David D.
0 Kudos
Message 2 of 6
(4,154 Views)

Dear David,

         Thanks for your warm response. I already tried to find with following functions: 

ExcelRpt_SetApplicationAttribute ();

ExcelRpt_SetWorksheetAttribute ();

ExcelRpt_SetCellRangeAttribute ();

 

But I didnot find the attribute related to removing filter and unfreezing panes. I checked with the other functions also. Could you please help me in finding the functions.

 

Thanks & Regards,

Rajesh

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

Hello Rajesh,

 

Yes it looks like "Microsoft Excel 9.0 Object Library" is the instrument to use rather than "Excel Report". It's important to note that when I loaded the "Excel Report.fp" the "Excel2000.fp" loaded as well which is what loaded the "Microsoft Excel 9.0 Object Library" instrument.

 

Could you tell me exactly how you perform this functionality in Excel (ie which menu you go to, etc) in detail so that I can try and assist you further. Also, which version of excel are you using? Which version of CVI?

 

The "Microsoft Excel 9.0 Object Library" instrument has MANY more functions than "Excel Report" so I am hopeful that we can find the functionality you desire here.

With warm regards,

David D.
0 Kudos
Message 4 of 6
(4,127 Views)

Hi David,

      I am using Excel 2000 and CVI 8.5.

  Menu for unfreeze / freeze-------> Window ==> Freeze Panes

   Menu for removing filter / Auto filter-------> Data==> Auto filter

 

At the same time, I will try with Excel2000.fp

 

Thanks & Regards,

Rajesh

0 Kudos
Message 5 of 6
(4,120 Views)

Hello Rajesh,

 

I am not sure about Excel 2000 but I found that the following snippet is the proper procedure for 2003 (and should be 2007 as well):

 

ExcelRpt_ApplicationNew (VTRUE, &ExcelAppHandle);
ExcelRpt_WorkbookNew(ExcelAppHandle,&WorkBookHandle);
ExcelRpt_GetWorksheetFromIndex (WorkBookHandle, 1, &WorkSheetHandle);                
Excel_GetProperty (ExcelAppHandle, NULL,Excel_AppActiveWindow, CAVT_OBJHANDLE, &WindowHandle);
Excel_SetProperty (WindowHandle, NULL, Excel_WindowSplitRow,CAVT_LONG, 5);
Excel_SetProperty (WindowHandle, NULL, Excel_WindowFreezePanes, CAVT_BOOL, VTRUE);

 


This code is thanks to  a customer (you are awesome Aric!). I believe that the resources he used the most were found here:

 

 http://support.microsoft.com/default.aspx/kb/q222101/

 

Unfortunately, in the case of ActiveX often we are limited to the help and what functionality is exposed by a 3rd party. In many cases this means going through 3rd party documentation on functions, classes, etc.

 

In this case Aric did a great job of this and has provided this snippet for us. Thanks again to Aric for all his hard work! 

With warm regards,

David D.
0 Kudos
Message 6 of 6
(3,971 Views)