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?
 
forget about saving the file right now...
let's figure out why Format(date...) isn't working...

does this work?

Sub Savefile()
msgbox Format(Date, "mm-dd-yyyy")
End Sub


If this doesn't work, then there is something somewhere..some function/macro/variable or possibly even a Defined Name that is called Date.


Could also possibly be a missing reference.

From VBA, click Tools - References.
Does anything say "missing"?
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Actually, could also be a function/macro named "Format"

Which actually seems more likely now that I think about it.
 
Upvote 0
There is something called format...good call...I will try it out and let you guys know if that works
 
Upvote 0
FWIW
Lyns code works fine, and The error mentioned by JonMo is spot on.
That's where I'd be looking,... for a Sub or Function called Format
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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