PDA

View Full Version : Please Help Procedure not working



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

Jack58
09-10-2004, 07:06 AM
I had a Macro witht the title of "Format" in the Series of VBA I have for my reports.

I do not understand how this "Format" title of a Macro that was written could cause the problem I posted above.



Jack

shades
09-15-2004, 01:08 PM
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.


Howdy, Jack. Is this with a Mac version of Excel? If so, you need to reference the file differently. If you are using Excel v. X or Excel 2004, in OS X, I can provide that info tonight, if someone doesn't do that first.