2007 v 2003 compatability

R

Rick

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
 
B

Barb Reinhardt

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
 
D

Dave Peterson

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.)
 
B

Barb Reinhardt

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!
 
D

Dave Peterson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top