+ Reply to Thread
Results 1 to 16 of 16

Me.Saved not working

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Me.Saved not working

    I have this in the ThisWorkbook module:
    Please Login or Register  to view this content.
    In Excel 2003 it always convinced Excel that the workbook was saved, so no save prompts appeared. Now in 2010 the code doesn't appear to be working, because I'm getting the "Save" prompts again. Is there updated code I could be using instead?

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Me.Saved not working

    See if this works for you...

    Please Login or Register  to view this content.
    HTH
    Regards, Jeff

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Me.Saved not working

    Jeff,

    Thanks, but you missed the point. The workbook is opened so that changes can be made to it and saved elsewhere under another name, but when the original template is closed I don't want any changes saved to it. The "Me.Saved" used to convince Excel that the workbook had ALREADY been saved, so there was no prompt to save changes.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Me.Saved not working

    the code is the same in 2010. do you have any application-level event code?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Me.Saved not working

    Why not just make it read-only?
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Me.Saved not working

    Good question. I set it up about two years ago, and I know there was a reason I didn't make it read-only, but the reason escapes me now. But I've noticed that other workbooks that I've set up with "Me.Saved" are also prompting for a save when closing. It's been only a minor annoyance, not a problem, but now it's happening with my bread and butter application.

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Me.Saved not working

    have you tested that the event is actually being triggered? I like to add a debug.print to events that don't do anything obvious.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Me.Saved not working

    I think you've missed the point of templates, you save them with the xltm extension then you cannot overwrite a template. xltx for non-macro templates
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  9. #9
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Me.Saved not working

    Roy,

    I think you may have hit on something I HAVE missed. When I mentioned "template", basically what I'm talking about is a workbook filled with a bunch of code and pre-formatted worksheets. When my main tool runs, it opens my "template", and pulls data from about 20 other workbooks to fill it, then saves it 15 different ways, then shuts it down. I THOUGHT, when I started this post, that that was the one that was giving me the problem. It wasn't. BUT, I never thought of saving it as a Template rather than a Workbook; would that give me any benefit?

    By the way, the real culprit giving me the error message didn't have the Me.Saved code. It's closed by this routine:
    Please Login or Register  to view this content.
    So, it may be that the "ActiveWorkbook.Close False" isn't working the same as it did. I've added the Me.Saved code, and will try it out again tomorrow morning.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Me.Saved not working

    You realize the last line of code will never execute?

  11. #11
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Me.Saved not working

    You mean the 'Activeworkbook.Close False' line? It worked just fine in 2003, but sure doesn't appear to work in 2010.

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Me.Saved not working

    The active workbook (and all other) gets closed because you quit Excel with the prior line.

  13. #13
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Me.Saved not working

    When I was setting it up (in 2003) if I closed the activeworkbook first, the application never quit. Moving it below the Application.quit closed the workbook without requesting to save changes, and closed the application. I just tried moving that line, closing the Activeworkbook first; Excel never closed.

  14. #14
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Me.Saved not working

    If you close the workbook containing the running code, or quit the application, the last line to execute is whichever line did one of those things. How could it be otherwise?

  15. #15
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Me.Saved not working

    So then, I guess what you're telling me is that the line
    Please Login or Register  to view this content.
    has no value because the Application.Quit will take care of closing it anyway? Maybe that's why I had the Me.Saved in it in the first place.

  16. #16
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Me.Saved not working

    Yes. If you quit Excel, how could the workbook be running?

+ 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