Save Macro Enabled File As New File Using VBA

WildBird

New Member
Joined
Jun 7, 2022
Messages
17
Office Version
  1. 365
Platform
  1. MacOS
I could use some help debugging a macro I am trying to make that saves a new version of the workbook with the current date (e.g. 06-Jun-22_Macro Tests).
I keep getting the error Run-time error 1004 Method 'SaveAs of object '_Workbook' failed.
Here is what I have. Any help is appreciated!

Screen Shot 2022-06-07 at 3.23.50 PM.png


Sub Save_New_WB()
'
' Save_New_WB to save a current version of the workbook with the date
'
' Define Variable Types
Dim path As String
Dim filename_new As String

' Folder where file should be saved
path = "/Users/chlowin1/Desktop/Wildbird Engineering/Save Updates Here/"

' File name with current date
filename_new = Format(Now, "dd-mmm-yy") & "_Macro Tests"

' Save as new file
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs filename:=path & filename_new, FileFormat:=52
Application.DisplayAlerts = True
ActiveWorkbook.Close

End Sub
 

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
check your folder path
' Folder where file should be saved

path = "C:\Users\chlowin1\Desktop\Wildbird Engineering\Save Updates Here\"
 
Upvote 0
I got it to work by closing the workbook and re-opening it.
 
Upvote 0

Forum statistics

Threads
1,215,324
Messages
6,124,249
Members
449,149
Latest member
mwdbActuary

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