Consulting

Results 1 to 4 of 4

Thread: Excel 2007 Saving issues

  1. #1

    Excel 2007 Saving issues

    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:

    [vba]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
    [/vba]

    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.

  2. #2
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    try replacing FileFormat:

    with

    [vba]
    FileExtStr = ".xlsm": FileFormatNum = 52[/vba]

    you'll have to declare FileExtStr as String.
    Peace of mind is found in some of the strangest places.

  3. #3
    that doesn't work im afraid - im now getting the error message:

    Compile Error: Expected: named Parameter

    before I even run the code.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    SaveCopyAS only has the filename argument.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •