Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
Problems using Excel Sort Method
Hello all.
I'm running into a strange problem trying to use Excel (97) Sort Method.
The (corrected) syntax is as follows:
Sort([Key1],[Order1],[Type],[Key2],[Order2],[Key3],[Order3],[Header],[OrderCustom],[Matchcase],[Orientation],[SortMethod])
I have a variable, nBottom, which holds the row number of the bottom of the range-to-be-sorted on a worksheet, oRecord. I am sorting columns A through N, starting with row 2 [Row 1 contains headers ... I have tried the same statement including Row 1 in the range and simply specifying that there ARE headers, and I get the same error.]
My line is:
oRecord.Range("A2:N"+ALLTRIM(STR(nBottom))).Sort(oRecord.Range("A2"), xlAscending, , ;
oRecord.Range("B1"), xlAscending, oRecord.Range("C2"), xlAscending, xlNo, 1, ;
.F., xlTopToBottom)
I do not get an error when I save my class code or build my PRG. When the app is actually running, FoxPro shoots up an error that just says "Syntax Error", and this is the line that it halts on.
Any ideas??
I've checked this against the recorded-macro-code for doing the same thing (without the use of "nBottom" of course), and everything SEEMS to match up! Is this a bug for which I just am not happening to stumble across the documentation? I've found some for some others (such as the incorrect ordering of the parameters, the corrected listing of which I've used above).
Thanks so much!
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement