save file with current date

spq24

Board Regular
Joined
Jan 18, 2010
Messages
52
Hello

I am trying to save the file with a value from a cell followed by the current date

example: filename 5-26-2011

Here's the code I have:

ActiveWorkbook.SaveAs Filename:=Range("O29").Value & Format(Now(), "mm-dd-yyyy")

When I do that an error pops up:
Compile error:

Wrong number of arguments or invalid property assignment

can anyone help?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Your code worked in a test workbook for me.

What do you have in cell "O29"?
Could it contain characters not allowed in a filename?
 
Upvote 0
try this

Code:
Sub Savefile()
TDate = Format(Date, "mm-dd-yyyy")
ActiveWorkbook.SaveAs Filename:=Range("O29").Value & TDate
End Sub
 
Upvote 0
I'm still getting the same error. It goes right to the "Format" argument which has nothing to do with what's in Cell O29 it has to do with the date. It worked once but it's not working now and I cna't figure it out
 
Upvote 0
Its just text that is formatted as General and yes I tried yours as well. I really can't figure out why I'm getting this error
 
Upvote 0
is there anyway around this? Like a formula or I can copy and paste...I can't get around that right now cause the today() formula uses / which I can't save with
 
Upvote 0
do you have another function or macro that you've named "Date" ?

If so, rename it to something else...say MyDate

Avoid using VBA keywords as precedure names and variables.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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