tags:

views:

537

answers:

3

I have a weird situation where I have a set of excel files, all having the extension .xls., in a directory where I can open all of them just fine in Excel 2007. The odd thing is that I cannot open them in Excel 2003, on the same machine, without opening the file first in 2007 and going and saving the file as an "Excel 97-2003 Workbook". Before I save the file as an "Excel 97-2003 Workbook" from Excel 2007, when I open the excel files in 2003 I get the error that the file is not in a recognizable format.

So my question is: if I already have the excel file opened in 2007 and I already have the file name of the open file stored in a variable, programatically how can I mimic the action of going up to the "office button" in the upper right and selecting, "save as" and then selecting "Excel 97-2003 Workbook"? I've tried something like the below but it does not save the file at all:

ActiveWorkbook.SaveAs TempFilePath & TempFileName & ".xls", FileFormat:=56

Thanks for any help or guidance!

A: 

I'm not clear on whether you are just trying to convert all those files or if you are working on an application that will need to do that.

If the former, see if this is helpful : http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&displaylang=en

It allows you to open Office 2007 in earlier versions of Office.

Jay
Don't ask me why but the compatibility pack does not work. I'm trying to create an app to convert the files.
ABB
A: 

It sounds like you should try the compatibility pack, but I can't see why your vba doesn't work. I tried the below and it worked perfectly:

ThisWorkbook.SaveAs "C:\test" & ".xls", FileFormat:=56
burnside
I have the compatibility pack installed and it still doesn't work. Not sure why. If I take out the FileFormat:=56 it saves fine but when I add that in it simply doesn't save at all. Any ideas?
ABB
What happens if you try to "save as" under a different file name?
Jay
I just tried that and it did not work. I stepped through the code and made sure it hit that line of code and it did so I'm not sure if it has to do with my current setup on my machine or what. I'm at a loss.
ABB
The machine I'm testing it on has both 2003 and 2007 installed (I ran the code in 2007), but I'm not sure that would make a difference.
burnside
I tried it on another machine with a similar setup as mine (both 2003 and 2007 installed) and it worked. Very weird. Sorry to waste your time, I guess it's a just an issue with my machine's setup for some very odd reason.
ABB
No probs. Excel can be a temperamental beast.
burnside
A: 

This page: http://www.rondebruin.nl/saveas.htm has been helpful for me. You have to declare a different file type if you are saving from 2007 to 2003 and earlier.

guitarthrower