ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   2007 v 2003 compatability (https://www.excelbanter.com/excel-programming/415945-2007-v-2003-compatability.html)

Rick

2007 v 2003 compatability
 
I have written a macro ing Excel 2007, but when we try to run it using 2003
it falls over.

This is the first line of code it stops at. We are trying to sort on Row 1.

ActiveWorkbook.Worksheets("SAP ZAUMAT - WORKING").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("SAP ZAUMAT - WORKING").Sort.SortFields.AddKey:=_
Range("A1:AM1"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:=_xlSortNormal

(Sorry about the way it looks here)

How does this translate to 2003? Should it be different?

Thanks
Rick

Barb Reinhardt

2007 v 2003 compatability
 
I just recorded a sort with a header and this is what I got

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


--
HTH,
Barb Reinhardt



"Rick" wrote:

I have written a macro ing Excel 2007, but when we try to run it using 2003
it falls over.

This is the first line of code it stops at. We are trying to sort on Row 1.

ActiveWorkbook.Worksheets("SAP ZAUMAT - WORKING").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("SAP ZAUMAT - WORKING").Sort.SortFields.AddKey:=_
Range("A1:AM1"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:=_xlSortNormal

(Sorry about the way it looks here)

How does this translate to 2003? Should it be different?

Thanks
Rick


Dave Peterson

2007 v 2003 compatability
 
Just to add to Barb's response.

Lots of things got added in xl2007. You may find it much easier to develop in
xl2003 (or whatever the oldest version of excel you have to support), then test
to see if it still works in xl2007 (or all the newer versions).

(All that .sort.sortfields stuff was added in xl2007.)




Rick wrote:

I have written a macro ing Excel 2007, but when we try to run it using 2003
it falls over.

This is the first line of code it stops at. We are trying to sort on Row 1.

ActiveWorkbook.Worksheets("SAP ZAUMAT - WORKING").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("SAP ZAUMAT - WORKING").Sort.SortFields.AddKey:=_
Range("A1:AM1"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:=_xlSortNormal

(Sorry about the way it looks here)

How does this translate to 2003? Should it be different?

Thanks
Rick


--

Dave Peterson

Barb Reinhardt

2007 v 2003 compatability
 
You can develop in 2003, but there is no guarantee that it will all work in
2007. I have a workbook that will need to be used by users in 2003 OR 2007
so I'm having some fun! NOT!
--
HTH,
Barb Reinhardt



"Dave Peterson" wrote:

Just to add to Barb's response.

Lots of things got added in xl2007. You may find it much easier to develop in
xl2003 (or whatever the oldest version of excel you have to support), then test
to see if it still works in xl2007 (or all the newer versions).

(All that .sort.sortfields stuff was added in xl2007.)




Rick wrote:

I have written a macro ing Excel 2007, but when we try to run it using 2003
it falls over.

This is the first line of code it stops at. We are trying to sort on Row 1.

ActiveWorkbook.Worksheets("SAP ZAUMAT - WORKING").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("SAP ZAUMAT - WORKING").Sort.SortFields.AddKey:=_
Range("A1:AM1"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:=_xlSortNormal

(Sorry about the way it looks here)

How does this translate to 2003? Should it be different?

Thanks
Rick


--

Dave Peterson


Dave Peterson

2007 v 2003 compatability
 
You're right.

That's why I included that "then test to see if it still works..." phrase.

But I bet testing, er, fixing, is easier when developed in xl2003 and modified
for xl2007--rather than vice-versa.



Barb Reinhardt wrote:

You can develop in 2003, but there is no guarantee that it will all work in
2007. I have a workbook that will need to be used by users in 2003 OR 2007
so I'm having some fun! NOT!
--
HTH,
Barb Reinhardt

"Dave Peterson" wrote:

Just to add to Barb's response.

Lots of things got added in xl2007. You may find it much easier to develop in
xl2003 (or whatever the oldest version of excel you have to support), then test
to see if it still works in xl2007 (or all the newer versions).

(All that .sort.sortfields stuff was added in xl2007.)




Rick wrote:

I have written a macro ing Excel 2007, but when we try to run it using 2003
it falls over.

This is the first line of code it stops at. We are trying to sort on Row 1.

ActiveWorkbook.Worksheets("SAP ZAUMAT - WORKING").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("SAP ZAUMAT - WORKING").Sort.SortFields.AddKey:=_
Range("A1:AM1"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:=_xlSortNormal

(Sorry about the way it looks here)

How does this translate to 2003? Should it be different?

Thanks
Rick


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 05:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com