LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Sort method from Javascript automation

I found that using "" for the type argument seemed to work, i.e., column s
sorted.

My code:
excelapp = new ActiveXObject("Excel.Application");
excelapp.visible = true;
excelapp.workbooks.open ("c:\myfile.xls");
xl=excelapp.activesheet;
myrange = xl.range("A1:C6");
myrange.sort(xl.columns(1),1,xl.columns(2),"",1,xl .columns(3),1,1,1,0,1);

--
Jim
"smr78" wrote in message
...
| Hi,
| I try to sort a worksheet range with 3 criterias as allowed by Sort method
| programmed in Javascript.
| The problem is that the sort is performed on the first and third criteria
| but not performed on the second criteria.
| As I read on an older post, there is the same problem with Vbscript as the
| second criteria is not taken into account when there are 3 criterias.
| My simplified code is :
|
| excelapp = new ActiveXObject("Excel.Application");
| excelapp.workbooks.open (myfile.xls);
| excelapp.activeworkbook.worksheets(mysheetname).se lect();
| xl=excelapp.activesheet;
|
myrange.sort(xl.columns(1),1,xl.columns(2),null,1, xl.columns(3),1,1,1,0,1);
|
| Referring to the short Sort method arguments list :
| expression.Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header,
| OrderCustom, MatchCase, Orientation, SortMethod)
| it seems that the Type argument is not well passed to Excel, since the
| following code is effective :
| myrange.sort(xl.columns(1),1,xl.columns(2));
|
| As soon the Type argument is listed, the second column is not sorted.
|
| Could someone knows how to pass the Type argument?
| The null and "" values are the only values accepted in my tests. An empty
| value (as in VBscript) is not accepted.
|
| Thank you for any help.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sort method benb Excel Programming 6 April 7th 05 04:00 PM
Sort Method more than 3 cols Molasses26 Excel Programming 1 March 31st 05 04:13 PM
Using the Sort Method Jill E Excel Programming 2 August 6th 04 01:29 PM
Sort Method Squid[_3_] Excel Programming 3 March 2nd 04 02:25 PM
Sort Method Questions pikus Excel Programming 2 February 3rd 04 03:46 PM


All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"