Consulting

Results 1 to 3 of 3

Thread: Please Help Procedure not working

  1. #1
    VBAX Regular Jack58's Avatar
    Joined
    May 2004
    Location
    MN
    Posts
    30
    Location

    Please Help Procedure not working

    I have used the following code in my reports for months,

    [vba]
    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
    [/vba]

    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

  2. #2
    VBAX Regular Jack58's Avatar
    Joined
    May 2004
    Location
    MN
    Posts
    30
    Location

    Answer but not undrestood

    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

  3. #3
    Mac Moderator VBAX Expert shades's Avatar
    Joined
    May 2004
    Location
    Kansas City, USA
    Posts
    638
    Location
    Quote Originally Posted by Jack58

    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.

    Software: LibreOffice 3.3 on Mac OS X 10.6.5
    (retired Excel 2003 user, 3.28.2008 )
    Humanware: Older than dirt
    --------------------
    old, slow, and confused
    but at least I'm inconsistent!

    Rich

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •