LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change the attribute of a cell in an Excel document from Cvi?

Hi.
I want to modify line border to one group of cells in a sheet from Cvi. I tried to use these functions:

Excel_SetProperty (ExcelRangeHandle, NULL, Excel_BordersValue,CAVT_VARIANT, 4);
Excel_SetProperty (ExcelRangeHandle, NULL,Excel_BordersLineStyle, CAVT_VARIANT, 4);

I didn't get any result. I think the problem is the value (4) that is not recognized or may be is something else.

Thanks.
0 Kudos
Message 1 of 2
(3,103 Views)
I have been working real hard to reproduce this issue and my first step was to create this functionality with LabVIEW. I was easily able todo this by doing what you do above. I aquire a range reference then modify the linestyle property on borders. Now I tried to do this exact call in CVI and used your exact code and the....

Excel_SetProperty (ExcelRangeHandle, NULL,Excel_BordersLineStyle, CAVT_VARIANT, 4);

The only change I make is...
error = Excel_SetProperty (ExcelRangeHandle, NULL,Excel_BordersLineStyle, CAVT_VARIANT, 4);

now this command ends up throwing an 'Invalid Method Error' when it reaches this command

ReportAppAutomationError (error);

Therefore, for some unknown reason that is not a valid method in CVI. I will continue to look into
this but I wanted to let you know to see if it sparked anymore ideas on your end.

A workaround to this is you could always call a macro.

Hope this shines some light on the subject...

Have a great day!!!

Allan S.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 2
(3,103 Views)