LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Change format of numbers in excel cells

I'm trying to write data to Excel using Labwindows/CVI with ActiveX. I have successfully written the data (numbers) to the Excel worksheet, and now I want to change the format of how the numbers are displayed in the cells, such as the precision and how many digits are displayed. This is the operation done equivalently on Excel by right clicking on the cell and choosing "format" and then going to the "numbers" tab. I cannot figure out which of the many library functions from the Excel 9.0 Object libraries to use. In your explanation, please also include how I would enter the parameters to obtain a specific number formatting. For example, how I would get a number to show only 2 digits after the decimal? Thanks
0 Kudos
Message 1 of 2
(3,019 Views)
If you use the excelreport that came with CVI 6.0 you can do it by using the function to change the range attributes. The constants are available in the header files and the function is in the FP file. You pass in a string that represents the format. So if you wanted to show only two digits after you would pass "0.00" as the attribute value.

I know this is possible to do without excelreport. I saw the code for it today but I'm not at work right now. If you need more help, I'll post the code tomorrow.
0 Kudos
Message 2 of 2
(3,019 Views)