VBA ERROR '1004' Method 'save as'

hajiali

Well-known Member
Joined
Sep 8, 2018
Messages
624
Office Version
  1. 2016
Platform
  1. Windows
1606067844077.png


Keep getting the above error on the
VBA Code:
ActiveWorkbook.SaveAs Filename:="C:\LOGS\" & "DEC" & " " & "RSS LOGS" & ".xlsx", FileFormat:=51

The wired part is that the new workbook gets named DEC RSS LOGS however it does not save in the file path nor does it allow me to manually save it I get the following message


1606068163964.png


VBA Code:
Sub ExportEL()
    Application.ScreenUpdating = False
    Dim srcWS As Worksheet, x As Long, rDate As Date
    Set srcWS = ThisWorkbook.Sheets("RSS LOGS")
    rDate = srcWS.Range("K1")
    x = Day(Format(Excel.Application.WorksheetFunction.EoMonth(srcWS.Range("K1").Value2, 0), "yyyy-mm-dd"))
    Workbooks.Add 1
    For x = 0 To x - 1
        srcWS.Copy after:=Sheets(Sheets.Count)
        ActiveSheet.Name = Format(rDate + x, "dd")
        Range("K1") = Range("K1") + x
    Next x
    Application.DisplayAlerts = False
    Sheets(1).Delete
    Application.DisplayAlerts = True
    ActiveWorkbook.SaveAs Filename:="C:\LOGS\" & "DEC" & " " & "RSS LOGS" & ".xlsx", FileFormat:=51
    Application.ScreenUpdating = True
End Sub

Attachments
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Are you shure this is right path.
In my computer system folder logs stays after one few folders before.
Unhide all folders and check that.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

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