VBA to save file as a Name & Cell Vaue

amxtomzo

Active Member
Joined
Nov 7, 2009
Messages
312
I am trying to have the file name, be made automatic as we save it

I would like this file to be named:
"Meriden Online 04-23-2019"
When finished

I keep getting a save as method failed error

here is what I have so far

Rich (BB code):
Dim Path As String
    Dim filename As String
    
   
    Worksheets("Enter inserts here").Select
    
     Path = "\\repub-file1.repub.local\packaging\ATEST\"
    filename = "Meriden Online " & ActiveSheet.Range("C1") & Format(Date, "mm-dd-yyyy")
    ActiveWorkbook.SaveAs filename:=Path & filename & ".xls", FileFormat:=xlNormal
Thank You

Thomas
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
What is in cell C1 on the active sheet when it fails?
Also what version of Xl are you running this in?
 
Upvote 0
In that case the filename should be
Code:
FileName = "Meriden Online " & Format(ActiveSheet.Range("C1"), "mm-dd-yyyy")
Are you trying to saveas an xls file, or is that a typo?
 
Upvote 0
YES, trying to save as .xls
still have a few older machines here

you code worked great

than you very much for your help

Thomas
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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