LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel-Activex Question for Alberto (or anyone else)

Another Excel-related question for you:

How can you sort in a descending order a set of rows, using the values of a column (say the first). There is a example online, but it does not work in my case, because I tried to sort by a column which value is “date” type. Perhaps you know of a way to work this problem out by activex?

In excel, I can perform the function by selection the rows to be sorted, and click descending sort. Could you call this from labview?

Also, my e-mail is sankow@hotmail.com. If you do not mind, it will be great if you could send me an email. That way, in the future I will be able to ask you directly!

Thanks again
0 Kudos
Message 1 of 3
(2,920 Views)
I assume that you are trying to sort the columns in Excel. I do not know the commands or if it is exposed in Active.X One place you might want to look is VBA, the scripting editor of Excel. Many times the commands used here are the same that can be called with activeX from labview. At the very least, you can create a script and call the script from LabVIEW.
Message 2 of 3
(2,920 Views)
You can call the Excel sort function by ActiveX and feed the sort parameters into the method function.

1. Starting with your Automation Refnum to the worksheet, wire up a Method Node->Range.
Wire a string constant of "A1" or any cell within the range to Cell1.
2. Wire the output of Range to a Property Node->CurrentRegion.
This will automatically find the entire block of data to be sorted.
3. Then wire the CurrentRegion output to the Method Node->Sort function.
You can then create a constant for Sort1 of xlDescending and specify the column for Key1 as "A:A".

The date should not be a problem unless the values were forced to be text strings in Excel. In that case you will not get the right results.

Michael
http://www.stitchofclass.
com
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
Message 3 of 3
(2,920 Views)