PDA

View Full Version : Excel 2007 Saving issues



paddysheeran
09-13-2010, 05:21 AM
I've been experiencing problems saving files when a user is running my macro in Excel 2007. I thought this issue had been dealt with previously but all of a sudden I'm getting a "Compile Error - named argument not found" message when trying to execute my code:

Sub Save_BackupReport_In2007(Backup_Folder)

ActiveWorkbook.SaveCopyAs _
Filename:=Backup_Folder & "Weekly", _
FileFormat:=xlExcel8
End Sub
Sub Save_CurrentReport_In2007(Templatepath, CurrentValue)

ActiveWorkbook.SaveAs _
Filename:=Templatepath & "\Weekly - WE" & Format(CurrentValue, "dd-mm-yy"), _
FileFormat:=xlExcel8
End Sub
Sub Save_Backup_Report()
If Val(Application.Version) > 11 Then
Save_BackupReport_In2007 Backup_Folder
Else
ActiveWorkbook.SaveCopyAs Filename:= _
Backup_Folder & "Weekly Template.xls"
End If
End Sub
Sub Save_Current_Report()
If Val(Application.Version) > 11 Then
Save_CurrentReport_In2007 Templatepath, CurrentValue
Else
ActiveWorkbook.SaveAs Filename:= _
Templatepath & "\Weekly - WE " & Format(CurrentValue, "dd-mm-yy") & ".xls"
End If
End Sub


The FileFormatt:= part of the code is highlighted when I get the error message. I've treid using FileFormat:=56 but this doesn't work either. Really stuck with this and any help people can give would be greatly appreciated.

thanks,

Padddy.

austenr
09-13-2010, 06:38 AM
try replacing FileFormat:

with


FileExtStr = ".xlsm": FileFormatNum = 52

you'll have to declare FileExtStr as String.

paddysheeran
09-13-2010, 08:26 AM
that doesn't work im afraid - im now getting the error message:

Compile Error: Expected: named Parameter

before I even run the code.

Bob Phillips
09-13-2010, 08:47 AM
SaveCopyAS only has the filename argument.