+ Reply to Thread
Results 1 to 5 of 5

Stopping the save function...until a user has clicked "save as".

  1. #1
    Registered User
    Join Date
    01-29-2010
    Location
    Lincs
    MS-Off Ver
    Excel 2003
    Posts
    5

    Stopping the save function...until a user has clicked "save as".

    Hello folks,

    Your favourite nooby here.

    Basically I want to block the 'save' function of an excel workbook. Being a template I want the user to have to Save As, to keep the original template in tact, then they can do whatever they want with it once it's on their local system.

    Stopping the save function and displaying a nice message is part 1 of the issue.

    Please Login or Register  to view this content.
    This works perfectly for that....however, once they have renamed, they STILL need to "Save As" after, which is annoying.

    Is there something I can add to this code to stop this once the user has changed the name of the workbook in someway?

    I was thinking something along the lines of:

    (This is in Toyneycode, the language of my brain and in no way affiliated with Excel!)

    Please Login or Register  to view this content.
    In my brain, as soon as they "saved as" and therefore changed the name of the workbook, the code would realize this and allow them to 'save' as normal again!

    Or am I just being too hopeful!

    Thanks in advance

    Toyney

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Stopping the save function...until a user has clicked "save as".

    Try this
    Please Login or Register  to view this content.
    Or a variation to suit
    Last edited by Marcol; 02-26-2010 at 07:29 AM. Reason: Forgot wbname extn

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: Stopping the save function...until a user has clicked "save as".

    Good morning ExcelToyney

    If you have no other event driven code, then just use this line after the user has used Save As :

    Please Login or Register  to view this content.
    This will simply disable the event that fires when the user attempts to save - so the user doesn't get the warning.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Registered User
    Join Date
    01-29-2010
    Location
    Lincs
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Stopping the save function...until a user has clicked "save as".

    I've just realised that doesn't work perfectly.

    For example, if somebody tries to save, it will bring up that message and they will probably save as. However, if it brings up the message and they then quit the spreadsheet, it then prompts them to save the sheet. As the code has stopped working.

    Basically I need the sheet to not allow them to just 'save' until they have saved as something different, when they have, then they can save again.
    Last edited by ExcelToyney; 02-26-2010 at 09:48 AM. Reason: Me being a fool

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Stopping the save function...until a user has clicked "save as".

    Try this ------- (or a variation to suit your needs)

    Please Login or Register  to view this content.
    It's not bullet proof - the user could overwrite in the saveas dialog box response

    "The file Template.xls already exists. Do you want to replace the existing file?"

    Or save in a different location

    Just how hard do you want try to stop wrong input?
    Last edited by Marcol; 03-01-2010 at 07:50 AM. Reason: redundant code removed

+ 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