PDA

View Full Version : Save As Issues (excel 2003 and excel 2007)



paddysheeran
10-22-2009, 08:50 AM
Hi All,

I've done a bit of searching around but not been able to find a simple answers to my problem. I am currently using excel 2003 to build my vba code. A number of people in my team have switched over to Excel 2007 and certain macros are failing.

My need if for any user(s) (2003 or 2007) to be able to open my workbook, run the macros which when completed re-save the file as an .xls file.The user(s) should then be able to re-open it at a later date for complete the same process.

Im currently using the following code to save:

ActiveWorkbook.SaveAs Filename:= _
Backup & "CustomerFaults_DataSheet_Backup " & Backup_Month & ".xls", FileFormat _
:=xlExcel9795, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False

any help would be greatly appreciated.

thanks,

Paddy.

Bob Phillips
10-22-2009, 09:12 AM
Application.DisplayAlerts = False
If Val(Application.Version) > 11 Then
SaveFileIn2007 Backup, Backup_Month
Else
ActiveWorkbook.SaveAs _
Filename:=Backup & "CustomerFaults_DataSheet_Backup " & Backup_Month
End If
Application.DisplayAlerts = True


and, THIS IS VERY IMPORTANT, put this code all on its own in a separate module



Sub SaveFileIn2007(Backup, Backup_Month)

ActiveWorkbook.SaveAs _
Filename:=Backup & "CustomerFaults_DataSheet_Backup " & Backup_Month, _
FileFormat:=xlExcel8
End Sub