Consulting

Results 1 to 11 of 11

Thread: Method 'SaveAs' of object'_Workbook failed

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Feb 2021
    Posts
    33
    Location

    Method 'SaveAs' of object'_Workbook failed

    Hello.

    I keep getting the above (title) error message on the below line of code. I've tried a few alternatives but can't seem to get past this error message. Can't think for the life of me what's going wrong. I'm thinking the problem stems from the file name in O6.

    File name in Range O6. See Attached.


        
    Dim formattedCurrentDate As String
    formattedCurrentDate = Format(Date, "dd-mm-yyyy")
    Dim FName As String
    Dim FPath As String
    Dim Newbook As Workbook
    Dim filename As String
    Dim WB As Workbook
    ActiveSheet.Unprotect
    Sheets("SUMMARY").Select
    ActiveSheet.Unprotect
    Sheets("TOTAL WEEK").Select
    ActiveSheet.Unprotect
    Sheets(Array("SUMMARY", "TOTAL WEEK")).Select
    Sheets(Array("SUMMARY", "TOTAL WEEK")).Copy
    Sheets("SUMMARY").Select
    Cells.Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Range("A1").Select
    Sheets("TOTAL WEEK").Select
    Cells.Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    FPath = "Q:\Finance\Accounts\Finance\CASH, BANK and LOANS\Client Account Reconciliations\Solutions Client accounts\TOCS\Client Reports\WMT\Client Reports"
    FName = Range("O6")
    Set WB = ActiveWorkbook
    WB.SaveAs filename:=FPath & FName & ".xlsx", FileFormat:=1
    WB.Close
    Attached Images Attached Images

Posting Permissions

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