SaveAs 2003 if opened in 2003 or 07?

Ouka

New Member
Joined
Mar 28, 2011
Messages
17
Hi all,

I have a macro that automatically generates a new file, moves some data from the source workbook, then saves the new file (no dialog to end user).

This new file must be in 2003 format.

Problem is, my end users are both 2003 and 2007 users.

Without modification to the code, if the user is in 2003 and executes, the file generated is of course 2003.xls If the user is in 2007 and executes the file is 2007.xlsx

I tried inserting the following:

Code:
ActiveWorkbook.SaveAs fileName:=getFilePath & wbName, FileFormat:=56

This works great in 2007, the new workbook is indeed saves as 2003.xls.

However 2003 throws an error, I'd guess because FileFormat:=56 doesn't exist in 2003

So how do I write a script that will always save as 2003 format regardless of what version of excel my macro is being executed in?

Thanks!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Ah. I see. It is contingent on the:

Code:
If Val(Application.Version) < 12 Then

argument, no?

Will try that out, thanks!
 
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,687
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top