+ Reply to Thread
Results 1 to 6 of 6

Requiring Save As without making file read only

  1. #1
    Registered User
    Join Date
    08-10-2006
    Posts
    58

    Requiring Save As without making file read only

    Hi Everyone,

    I have a file which is used as a template and can't be saved with data entered into it. My first thought is to password the file to only open as a read only, but that turned up two issues. First, this will likely confuse some of the users, as they are not well versed in computers beyond the basics. Secondly, I am adding a command button that will allow someone who doesn't know Excel very well (and subsequently, likely won't know any vba) to add things to the raw data in the template and save it as the current file name. That should be the only situation in which they can save this file as its current name. Perhaps I am just thinking about this too hard and its much easier than I am making it out to be, but if anyone can give me guidance, it would be appreciated.

    Thanks!

    Jeff

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    It sounds like this Workbook_beforeSave routine would help you. The user can save the workbook with any name except the originalTemplateName.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-10-2006
    Posts
    58
    Thank you very much! I haven't tried it yet, but I can tell that at the very least, it'll give me the base code that I wouldn't have been able to come up with myself. I appreciate you help!

    Jeff

  4. #4
    Registered User
    Join Date
    08-10-2006
    Posts
    58
    OK, so I've implemented the code and modified it to add in a password option to allow using the save button. I have a slight problem, however. The code still runs when using File>SaveAs. Did I end up altering it in some way that makes it come up all the time?

    Please Login or Register  to view this content.
    Thanks!
    Last edited by redstang423; 04-06-2007 at 04:00 PM. Reason: Thought I solved the problem, but I didn't.

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    The problem is that the Before_Save event occurs before the user enters the SaveAs box appears.

    Your routine will prevent the template being Saved (without password) .

    If you put

    Please Login or Register  to view this content.
    at the start of the routine, the routine won't run if the user has called SaveAs.

    On the other hand, the User will be able to click SaveAs and not change the name and still successfully save the template file.


    I'm reminded of an old saying, "it difficult to make anything foolproof, because fools are so ingenious."

    (P.S. I suspect you may have other questions. If so, I'm leaving town for the weekend, not ignoring you.)

  6. #6
    Registered User
    Join Date
    08-10-2006
    Posts
    58
    That works fine for my purposes. Its really just in there to try to prevent someone from accidentally saving over the template without knowing that you are about to do so. If there is a way to prevent saving with the same file name after using "SaveAs", I'll take it, but it isn't nessecary. I also just realized I changed how I was trying to set it up from what I originally posted, and I no longer have the button to start the save, and forgot to mention that part.

    Thanks for your help!

    Jeff

+ 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