+ Reply to Thread
Results 1 to 9 of 9

Generating Save As Name

  1. #1
    Registered User
    Join Date
    11-19-2009
    Location
    Liverpool, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Generating Save As Name

    I will be using my Excel worksheet for quoting individual customers and I am wondering whether I can specify that when the save button is pressed that it generates the destination file name from a cell or cells. eg the Customers name and registration. rather than using "save as" option.

    Thanks again

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Generating Save As Name

    This code goes in the Thisworkbook object.

    Uses the contents of A1 and B1 on sheet with a code name of Sheet1.
    You may want to control the path as well as the filename

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    11-19-2009
    Location
    Liverpool, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Generating Save As Name

    Brilliant, sorry to sound stupid but where do i enter the code.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Generating Save As Name

    right click a sheet tab and pick View code.
    In the project window double click the Thisworkbook object

    paste the code in there.

  5. #5
    Registered User
    Join Date
    11-19-2009
    Location
    Liverpool, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Generating Save As Name

    Hi,

    I have attached the workbook. I "think" i have followed your instructions correctly however when i press save I don't get the desired result.

    I need the save name to be B3 & B4 eg in this work book Chris Killen LR54UTM.

    Any help would be greatly appreciated.

    Thank you
    Attached Files Attached Files

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Generating Save As Name

    The code is working but it only works when you do a SAVEAS.

    If the workbook has already been saved then the name will not be changed.

    If you use the menu File > Saveas you will see the file is saved with the new details.

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Generating Save As Name

    If you want it for any save then remove the test for saveasui

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-19-2009
    Location
    Liverpool, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Generating Save As Name

    Sorry,

    What is the test savesaui?

    I am a complete amateur. Sorry

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Generating Save As Name

    If you save a new file or use the SaveAs option that paremeter is set to true by the system. That way you can detect whether the use is doing a saveas or just a normal save.

    Your first post asked for SaveAs. You may actually have meant any type of save. If so use the latest version of the code.

+ 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