J
Jenny B.
Hi All,
I use the below to save a copy of my worksheet to my desktop before its
contents are cleared. I would like to add a now() or today() date stamp to
the fName. Any ideas how to do that?
I’ve combined the ranges on my excel spreadsheet cell H5 with a text date
style =H5& " "&TEXT(TODAY(),"mm/dd/yy"). When I try to add this to the
macro below, I get this error –
Run-Time error 1004.
Any thoughts on how I can have the output file contain my H5 value which is
text and today’s date?
Thank you – Jenny B.
Sub Save()
Dim myPath As String
Dim nRng As Range
Dim fName As String
Set nRng = Range("H5")
ActiveSheet.Copy
Call DeleteAllCode
ActiveSheet.Shapes("Send").Visible = False
myPath = "C:\Documents and Settings\Name Here\Desktop\"
fName = nRng.Value & ".xls"
ActiveWorkbook.SaveAs filename:= _
myPath & fName, FileFormat:= _
xlNormal, Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
Call TransfertoLog
Call CLEAR
ActiveSheet.Visible = False
End Sub
I use the below to save a copy of my worksheet to my desktop before its
contents are cleared. I would like to add a now() or today() date stamp to
the fName. Any ideas how to do that?
I’ve combined the ranges on my excel spreadsheet cell H5 with a text date
style =H5& " "&TEXT(TODAY(),"mm/dd/yy"). When I try to add this to the
macro below, I get this error –
Run-Time error 1004.
Any thoughts on how I can have the output file contain my H5 value which is
text and today’s date?
Thank you – Jenny B.
Sub Save()
Dim myPath As String
Dim nRng As Range
Dim fName As String
Set nRng = Range("H5")
ActiveSheet.Copy
Call DeleteAllCode
ActiveSheet.Shapes("Send").Visible = False
myPath = "C:\Documents and Settings\Name Here\Desktop\"
fName = nRng.Value & ".xls"
ActiveWorkbook.SaveAs filename:= _
myPath & fName, FileFormat:= _
xlNormal, Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
Call TransfertoLog
Call CLEAR
ActiveSheet.Visible = False
End Sub