Jack58
09-10-2004, 06:26 AM
I have used the following code in my reports for months,
Sub filename(reportname As String, reportpath As String)
Dim NewFile As String
NewFile = reportname & CStr(format(Date, "mm-dd-yy")) & ".xls"
MsgBox prompt:="Your new file will be named " & NewFile
ActiveWorkbook.SaveAs filename:=reportpath & NewFile
End Sub
Now when I use it in a call (Example "Call filename("Pro Generics Compliance ", "X:\Purchasing\NRC Tasks\Daily\Jack's Tasks\Pro Generics Compliance\Archive\")
I am getting the format in the first line of code as a Compile error.
Can understand why this has worked for so long and now isn't.
Any help would be greatful.
Thanks
Jack
Sub filename(reportname As String, reportpath As String)
Dim NewFile As String
NewFile = reportname & CStr(format(Date, "mm-dd-yy")) & ".xls"
MsgBox prompt:="Your new file will be named " & NewFile
ActiveWorkbook.SaveAs filename:=reportpath & NewFile
End Sub
Now when I use it in a call (Example "Call filename("Pro Generics Compliance ", "X:\Purchasing\NRC Tasks\Daily\Jack's Tasks\Pro Generics Compliance\Archive\")
I am getting the format in the first line of code as a Compile error.
Can understand why this has worked for so long and now isn't.
Any help would be greatful.
Thanks
Jack