+ Reply to Thread
Results 1 to 5 of 5

Including Invoice # in Filename

  1. #1
    Registered User
    Join Date
    12-09-2010
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    8

    Including Invoice # in Filename

    Hello - Thanks for your assistance with my previous excel issues. Here's a new issue. I have an automated macro that increments a cell by one every time the file is opened; this value is my invoice number. See cell D3 in the attached file. I'd like to know how to incorporate this (invoice) number as part of the file name when the file is saved. Obviously, I'd like a new file each time the file is saved, and not to overwrite the previous file. I have attached the file with the embedded macro. Many thanks for your assistance!!!!
    Attached Files Attached Files

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Including Invoice # in Filename

    Assuming you're saving into c:\test (change this as applicable), use the code below in the workbook code area.
    It will save your workbook when the user wants to save or when the user closes the workbook as ""New Template - Rev - " and the value in D3.

    Please Login or Register  to view this content.
    Please click the * below if this helps
    Please click the * below if this helps

  3. #3
    Registered User
    Join Date
    12-09-2010
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Including Invoice # in Filename

    Yes, the above worked and many thanks!!! Sorry, need to refine the issue slightly. Instead of defining the directory explicitly, as done above, would it be possible to update the above code, or any code meeting the above filename requirements, including saving the file in current directory that the file is in? I don't want to explicitly define any particular directory; I want the file to be saved in the current directory, and the directory will continuously change. The file will be copied into the appropriate directories manually, as needed.

  4. #4
    Registered User
    Join Date
    12-09-2010
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Including Invoice # in Filename

    Please add the following functionality: 1) When the 'x' is selected, a pop-up to be dispalyed indicating if the file should be saved with 'Yes', 'No', & 'Cancel' options. 2) When 'Save As' is selected, the filename can be modified as per the 'normal' rules.

    Thanks again for your time.

  5. #5
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Including Invoice # in Filename

    Sure, change "C:\test\" in the code to ".\"

    Quote Originally Posted by cords View Post
    Yes, the above worked and many thanks!!! Sorry, need to refine the issue slightly. Instead of defining the directory explicitly, as done above, would it be possible to update the above code, or any code meeting the above filename requirements, including saving the file in current directory that the file is in? I don't want to explicitly define any particular directory; I want the file to be saved in the current directory, and the directory will continuously change. The file will be copied into the appropriate directories manually, as needed.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1