Save custom file names

option

Registered User.
Local time
Yesterday, 19:21
Joined
Jul 3, 2008
Messages
143
Hey guys,

I have a spreadsheet here that keeps track of my work through the day. If I want to save the file name with information from a cell, how would I do so?

My code:
Code:
Private Sub CommandButton2_Click()
Dim savename As String

savename = Range("e6") 'This is the cell with the info I need in the file 'name

ActiveWorkbook.SaveAs "C:\workflow\" & Format(Date, "yyyymmdd") & "savename" & ".xls"



End Sub

So the file should save as "20080805NAME" (name being what is populated in cell E6). If I could put an underscore in there, like, "20080805_NAME" that would be perfect.

Any ideas where I screwed this one up?:confused:
 
Code:
Private Sub CommandButton2_Click()
Dim savename As String

savename = Range("e6").value 'This is the cell with the info I need in the file 'name

ActiveWorkbook.SaveAs "C:\workflow\" & Format(Date, "yyyymmdd") & "_" & savename & ".xls"

End Sub
 
Amazing! Thanks!!!
 

Users who are viewing this thread

Back
Top Bottom