Excel 2003-2007 compatibility problems in VB

Will00

New Member
Joined
Jun 22, 2009
Messages
4
Hi,

Currently I have a file (Excel 2007 in "Compatibility Mode") that copies a sheet to a new book and saves the new book as a new name and closes it. The problem I am having is that when I reopen the newly created wb, it tells me its in a new format different from excel?? However eventually I am able to open it. Other people who do not have 2007 cannot open it. my save as dialogue states ".xls". I think I have isolated the problem, which is that with 07 when you save as there are many options but I do not know the code for those options, can anyone help?? I need the file to save as compaitiblity...

Sheets("Version1").Select
Sheets("Version1").Copy
thisfile = range("b24").Value & ".xls": FileFormatNum = 56
directory = "G:\Documents\XL\2009\"

range("a11:ag24").Select 'This range has linked information
Selection.Copy
Selection.pastespecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=directory & thisfile ' CODE BREAKS HERE
ActiveWorkbook.Close
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Don't save it as 2007 compatibility or otherwise, save it in an earlier version.

To do that specify the FileFormat argument in SaveAs, just setting the filename extension won't do it.

If you don't specify the format the file will be saved in the format of the version of Excel being used, and I suppose that will be 2007 in your case.:)
 
Upvote 0
Norie,

thanks for the reply, do you have any suggestions on how I can go about doing that? I have tried several methods with no avail
 
Upvote 0
Turn on the Macro Recorder and record yourself Saving the file, using Save As Type "Excel 97-2003 Workbook (*.xls)". You should be able to get the code changes you need to make from this recorded code.
 
Upvote 0
Dear all

Hopefully this is of use to someone, but in my case although Office 2007 opened my 2003 file in compatibility mode and saved it as a 2003 book, it did leave an Office 12.0 reference in the file. Under 2003 I unchecked this (as I was using no new functionality exclusive to 2007, but rather just adjusting the macro code within the usage parameters of 2003) and things worked fine.

phlinux
 
Upvote 0

Forum statistics

Threads
1,215,685
Messages
6,126,201
Members
449,298
Latest member
Jest

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