Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 2003 - 2000 incompatability

I've got an Excel application that was written in 2003. Now I find out I
have a user that is still using 2000, and at least one segment of my 2003
code is not working. I have a routine that selects a worksheet, and sorts it
by a particular field. When this user runs this code, it bomb on the last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing the
DataOption1 or the xlSortNormal, or something else in the Sort method. Would
greatly appreciate if someone could provide the correct code to run this in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 2003 - 2000 incompatability

Remove arguments OrderCustom:=1 and DataOption1:=xlSortNormal which are n/a
in XL2000.

If required, you can make version specific functions by placing the code
that won't be recognized in say XL2000 in a module that will only contain
procedures that will be called in later versions.

Regards,
Peter T

"Dale Fye" wrote in message
...
I've got an Excel application that was written in 2003. Now I find out I
have a user that is still using 2000, and at least one segment of my 2003
code is not working. I have a routine that selects a worksheet, and sorts

it
by a particular field. When this user runs this code, it bomb on the last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing the
DataOption1 or the xlSortNormal, or something else in the Sort method.

Would
greatly appreciate if someone could provide the correct code to run this

in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default 2003 - 2000 incompatability

Thanks, Peter. I'll take a look.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



"Peter T" wrote:

Remove arguments OrderCustom:=1 and DataOption1:=xlSortNormal which are n/a
in XL2000.

If required, you can make version specific functions by placing the code
that won't be recognized in say XL2000 in a module that will only contain
procedures that will be called in later versions.

Regards,
Peter T

"Dale Fye" wrote in message
...
I've got an Excel application that was written in 2003. Now I find out I
have a user that is still using 2000, and at least one segment of my 2003
code is not working. I have a routine that selects a worksheet, and sorts

it
by a particular field. When this user runs this code, it bomb on the last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing the
DataOption1 or the xlSortNormal, or something else in the Sort method.

Would
greatly appreciate if someone could provide the correct code to run this

in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 2003 - 2000 incompatability

Dave was right, only need to remove the DataOption1 argument, OrderCustom
works in XL2000 (contrary to what I had suggested)

If using the application specific If test as suggested by John, and the
module is headed Option Explicit, change xlSortNormal to its intrinsic
Constant value (in the immediate window ?xlSortNormal and hit enter)

Regards,
Peter T

"Dale Fye" wrote in message
...
Thanks, Peter. I'll take a look.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



"Peter T" wrote:

Remove arguments OrderCustom:=1 and DataOption1:=xlSortNormal which are

n/a
in XL2000.

If required, you can make version specific functions by placing the code
that won't be recognized in say XL2000 in a module that will only

contain
procedures that will be called in later versions.

Regards,
Peter T

"Dale Fye" wrote in message
...
I've got an Excel application that was written in 2003. Now I find

out I
have a user that is still using 2000, and at least one segment of my

2003
code is not working. I have a routine that selects a worksheet, and

sorts
it
by a particular field. When this user runs this code, it bomb on the

last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing the
DataOption1 or the xlSortNormal, or something else in the Sort method.

Would
greatly appreciate if someone could provide the correct code to run

this
in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 2003 - 2000 incompatability

if it's just sort routine causing problems then you could test for excel
version - something like:(not tested)

With Selection
If Val(Application.Version) < 11 Then
.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
MatchCase:=False, _
Orientation:=xlTopToBottom
Else
.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
End With
However, if more than this then follow Peter T suggestion.
--
JB


"Peter T" wrote:

Remove arguments OrderCustom:=1 and DataOption1:=xlSortNormal which are n/a
in XL2000.

If required, you can make version specific functions by placing the code
that won't be recognized in say XL2000 in a module that will only contain
procedures that will be called in later versions.

Regards,
Peter T

"Dale Fye" wrote in message
...
I've got an Excel application that was written in 2003. Now I find out I
have a user that is still using 2000, and at least one segment of my 2003
code is not working. I have a routine that selects a worksheet, and sorts

it
by a particular field. When this user runs this code, it bomb on the last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing the
DataOption1 or the xlSortNormal, or something else in the Sort method.

Would
greatly appreciate if someone could provide the correct code to run this

in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 2003 - 2000 incompatability

I don't think that this will compile in xl2k. That DataOption1 portion will
cause a compile error.

There are workarounds, though.

if val(application.version) < 11 then
'do the sort right here
else
'call a routine in a different module that is written for xl2002+
end if

By having the routine in a different module, xl2k won't even try to compile it.

john wrote:

if it's just sort routine causing problems then you could test for excel
version - something like:(not tested)

With Selection
If Val(Application.Version) < 11 Then
.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
MatchCase:=False, _
Orientation:=xlTopToBottom
Else
.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
End With
However, if more than this then follow Peter T suggestion.
--
JB

"Peter T" wrote:

Remove arguments OrderCustom:=1 and DataOption1:=xlSortNormal which are n/a
in XL2000.

If required, you can make version specific functions by placing the code
that won't be recognized in say XL2000 in a module that will only contain
procedures that will be called in later versions.

Regards,
Peter T

"Dale Fye" wrote in message
...
I've got an Excel application that was written in 2003. Now I find out I
have a user that is still using 2000, and at least one segment of my 2003
code is not working. I have a routine that selects a worksheet, and sorts

it
by a particular field. When this user runs this code, it bomb on the last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing the
DataOption1 or the xlSortNormal, or something else in the Sort method.

Would
greatly appreciate if someone could provide the correct code to run this

in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.





--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 2003 - 2000 incompatability

Hi Dave,
Earlier I suggested pretty much the same as you as to how to cater for
multiple versions.
But somewhat to my surprise John's example does compile in my XL2k providing
xlSortNormal is changed to its appropriate number.

Regards,
Peter T



"Dave Peterson" wrote in message
...
I don't think that this will compile in xl2k. That DataOption1 portion

will
cause a compile error.

There are workarounds, though.

if val(application.version) < 11 then
'do the sort right here
else
'call a routine in a different module that is written for xl2002+
end if

By having the routine in a different module, xl2k won't even try to

compile it.

john wrote:

if it's just sort routine causing problems then you could test for excel
version - something like:(not tested)

With Selection
If Val(Application.Version) < 11 Then
.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
MatchCase:=False, _
Orientation:=xlTopToBottom
Else
.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
End With
However, if more than this then follow Peter T suggestion.
--
JB

"Peter T" wrote:

Remove arguments OrderCustom:=1 and DataOption1:=xlSortNormal which

are n/a
in XL2000.

If required, you can make version specific functions by placing the

code
that won't be recognized in say XL2000 in a module that will only

contain
procedures that will be called in later versions.

Regards,
Peter T

"Dale Fye" wrote in message
...
I've got an Excel application that was written in 2003. Now I find

out I
have a user that is still using 2000, and at least one segment of my

2003
code is not working. I have a routine that selects a worksheet, and

sorts
it
by a particular field. When this user runs this code, it bomb on

the last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing

the
DataOption1 or the xlSortNormal, or something else in the Sort

method.
Would
greatly appreciate if someone could provide the correct code to run

this
in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.





--

Dave Peterson



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 2003 - 2000 incompatability

Hi Peter,
I had tried my suggested approach awhile ago for desktops using different
versions of Excel and much to my suprise, it worked. I think it's just one of
the Excel VBA quirks - you never know until you give it a go! However and as
I also stated, if changes required were more than just resolving sort routine
problem, Dale should follow your suggestion.
--
JB


"Peter T" wrote:

Hi Dave,
Earlier I suggested pretty much the same as you as to how to cater for
multiple versions.
But somewhat to my surprise John's example does compile in my XL2k providing
xlSortNormal is changed to its appropriate number.

Regards,
Peter T



"Dave Peterson" wrote in message
...
I don't think that this will compile in xl2k. That DataOption1 portion

will
cause a compile error.

There are workarounds, though.

if val(application.version) < 11 then
'do the sort right here
else
'call a routine in a different module that is written for xl2002+
end if

By having the routine in a different module, xl2k won't even try to

compile it.

john wrote:

if it's just sort routine causing problems then you could test for excel
version - something like:(not tested)

With Selection
If Val(Application.Version) < 11 Then
.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
MatchCase:=False, _
Orientation:=xlTopToBottom
Else
.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
End With
However, if more than this then follow Peter T suggestion.
--
JB

"Peter T" wrote:

Remove arguments OrderCustom:=1 and DataOption1:=xlSortNormal which

are n/a
in XL2000.

If required, you can make version specific functions by placing the

code
that won't be recognized in say XL2000 in a module that will only

contain
procedures that will be called in later versions.

Regards,
Peter T

"Dale Fye" wrote in message
...
I've got an Excel application that was written in 2003. Now I find

out I
have a user that is still using 2000, and at least one segment of my

2003
code is not working. I have a routine that selects a worksheet, and

sorts
it
by a particular field. When this user runs this code, it bomb on

the last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing

the
DataOption1 or the xlSortNormal, or something else in the Sort

method.
Would
greatly appreciate if someone could provide the correct code to run

this
in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.





--

Dave Peterson




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 2003 - 2000 incompatability

That's interesting (and surprising to me).

Do you have xl97 to test, too? Just curious.



Peter T wrote:

Hi Dave,
Earlier I suggested pretty much the same as you as to how to cater for
multiple versions.
But somewhat to my surprise John's example does compile in my XL2k providing
xlSortNormal is changed to its appropriate number.

Regards,
Peter T

"Dave Peterson" wrote in message
...
I don't think that this will compile in xl2k. That DataOption1 portion

will
cause a compile error.

There are workarounds, though.

if val(application.version) < 11 then
'do the sort right here
else
'call a routine in a different module that is written for xl2002+
end if

By having the routine in a different module, xl2k won't even try to

compile it.

john wrote:

if it's just sort routine causing problems then you could test for excel
version - something like:(not tested)

With Selection
If Val(Application.Version) < 11 Then
.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
MatchCase:=False, _
Orientation:=xlTopToBottom
Else
.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If
End With
However, if more than this then follow Peter T suggestion.
--
JB

"Peter T" wrote:

Remove arguments OrderCustom:=1 and DataOption1:=xlSortNormal which

are n/a
in XL2000.

If required, you can make version specific functions by placing the

code
that won't be recognized in say XL2000 in a module that will only

contain
procedures that will be called in later versions.

Regards,
Peter T

"Dale Fye" wrote in message
...
I've got an Excel application that was written in 2003. Now I find

out I
have a user that is still using 2000, and at least one segment of my

2003
code is not working. I have a routine that selects a worksheet, and

sorts
it
by a particular field. When this user runs this code, it bomb on

the last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing

the
DataOption1 or the xlSortNormal, or something else in the Sort

method.
Would
greatly appreciate if someone could provide the correct code to run

this
in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.





--

Dave Peterson


--

Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 2003 - 2000 incompatability

DataOption# was added in xl2002. Remove that line (and the preceding line
continuation characers) and it should work in xl2k.



Dale Fye wrote:

I've got an Excel application that was written in 2003. Now I find out I
have a user that is still using 2000, and at least one segment of my 2003
code is not working. I have a routine that selects a worksheet, and sorts it
by a particular field. When this user runs this code, it bomb on the last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing the
DataOption1 or the xlSortNormal, or something else in the Sort method. Would
greatly appreciate if someone could provide the correct code to run this in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.


--

Dave Peterson


  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default 2003 - 2000 incompatability

You could excise most of these arguments anyway, since they merely tell
Excel to use the defaults.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Dave Peterson" wrote in message
...
DataOption# was added in xl2002. Remove that line (and the preceding line
continuation characers) and it should work in xl2k.



Dale Fye wrote:

I've got an Excel application that was written in 2003. Now I find out I
have a user that is still using 2000, and at least one segment of my 2003
code is not working. I have a routine that selects a worksheet, and sorts
it
by a particular field. When this user runs this code, it bomb on the
last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing the
DataOption1 or the xlSortNormal, or something else in the Sort method.
Would
greatly appreciate if someone could provide the correct code to run this
in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.


--

Dave Peterson



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 2003 - 2000 incompatability

Personally, I like to specify all the parms (well, most the time <bg).

There are some parms for some methods that are carried over from one command to
another--and even shared with the user (via the user interface)--like the .Find
method.

(Yeah, I'm not too careful when it comes to removing the dataoption stuff.)

Jon Peltier wrote:

You could excise most of these arguments anyway, since they merely tell
Excel to use the defaults.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______

"Dave Peterson" wrote in message
...
DataOption# was added in xl2002. Remove that line (and the preceding line
continuation characers) and it should work in xl2k.



Dale Fye wrote:

I've got an Excel application that was written in 2003. Now I find out I
have a user that is still using 2000, and at least one segment of my 2003
code is not working. I have a routine that selects a worksheet, and sorts
it
by a particular field. When this user runs this code, it bomb on the
last
line of the code provided below.

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I don't know whether this is because Excel 9.0 is not recognizing the
DataOption1 or the xlSortNormal, or something else in the Sort method.
Would
greatly appreciate if someone could provide the correct code to run this
in
Excel 9.0.

Thanks.
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.


--

Dave Peterson


--

Dave Peterson
Reply
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
2000 vs. 2003 Bill G[_4_] Excel Programming 1 September 22nd 06 11:22 PM
Pie chart built in 2000, now in 2003 but unable to edit 2003-way Judith Rempel Excel Discussion (Misc queries) 0 September 21st 06 12:05 AM
i'm doing ecdl using 2003 but only have 2000? Andy Excel Discussion (Misc queries) 5 August 31st 06 01:41 AM
Upgrade from Excel 2000 to Excel 2003 without MS Office 2003? brigida3 Excel Discussion (Misc queries) 1 January 22nd 06 05:13 PM
VBA and 2002/2003/2000 Bill Sturdevant[_2_] Excel Programming 3 April 20th 05 03:24 PM


All times are GMT +1. The time now is 11:45 AM.

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

About Us

"It's about Microsoft Excel"