I use this
Sub saveme()
Dim wSheet As Worksheet
'Name Tab
UnProtectSheet
Application.EnableEvents = False
Application.ScreenUpdating = False
Start
Range("K1").Copy
Range("K1").PasteSpecial xlPasteValues
ActiveSheet.Name = Format(Range("K1").Value, "#")
Dim varfilestring, Testdate, EXIT1, EXIT2
varfilestring = vbNullString
Testdate = Range("r5")
If (Testdate) = "0" Then GoTo EXIT1
If (Testdate) <> -1 Then GoTo EXIT2
EXIT1:
MsgBox "No Valid Date Entered", vbOKOnly, "Date Error"
Range("A1:w59").Select
ActiveWindow.Zoom = True
Exit Sub
EXIT2:
Application.DisplayAlerts = False
varfilestring = Range("n4") & Range("k1") & " " & Range("B118") & " "
"for " & Format(Range("r5"), "dd-mm-yy") & ".xls"
ActiveWorkbook.SaveAs varfilestring, FileFormat:=xlNormal
password:="", WriteResPassword:="", ReadOnlyRecommended:=False
CreateBackup:=True
Range("B2").Select
Application.ScreenUpdating = True
UNDONE
Set wSheet = Nothing
Exit Sub
Application.EnableEvents = True
ProtectSheet
End Sub
The area you should be interested in is
varfilestring = Range("n4") & Range("k1") & " " & Range("B118") & " "
"for " & Format(Range("r5"), "dd-mm-yy") & ".xls"
ActiveWorkbook.SaveAs varfilestring, FileFormat:=xlNormal
password:="", WriteResPassword:="", ReadOnlyRecommended:=False
CreateBackup:=True
n4 is path i.e "e:\manning\" without quotes
k1 is a title " "
B118 is a text string
R5 is a date string for my purposes formatted as *14 March 2001 as i
the date example of format
the close makes it an .xls file
I run this from a VBA button on the sheet which triggers the macr