Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: disable save on exit prompt

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    John G
    Posts
    62
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    How can I disable the save prompt when excel is given the command to close?

    John

  2. #2
    MrExcel MVP Anne Troy's Avatar
    Join Date
    Feb 2002
    Location
    Westwood NJ
    Posts
    2,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    Workbook.Save = True

    End Sub


    Put that in a module in your workbook.
    ~Anne Troy

  3. #3
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-17 17:12, Dreamboat wrote:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    Workbook.Save = True

    End Sub

    I believe dreamboat meant

    ThisWorkbook.Saved=True

    and placed in the Thisworkbook object

    Ivan


    Put that in a module in your workbook.

  4. #4
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi jgoulart

    I think they both meant

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ThisWorkbook.Saved = Not Cancel
    End Sub

    This will "disable the save prompt when excel is given the command to close"





  5. #5
    MrExcel MVP Anne Troy's Avatar
    Join Date
    Feb 2002
    Location
    Westwood NJ
    Posts
    2,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sweet.

    Heck, I just tested mine and it worked for me.



    I'll learn, Ivan & Dave. What is the difference then?
    ~Anne Troy

  6. #6
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Tuggy, you wrote

    Workbook.Save=True

    There isn't any such Object as "Workbook" it must be either:

    "ThisWorkbook"
    "ActiveWorkbook"
    "Me"
    "Workbooks(me.name)"

    You also hade "Save" when it should be "Saved". "Save" is a Method while Saved is a Property.

    The reason i suggested my method was because yours (modified by Ivan) would stop the Workbook saving at any time and not "when excel is given the command to close"



  7. #7
    Board Regular
    Join Date
    Mar 2002
    Location
    Oregon
    Posts
    130
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Dave, good suggestions. I didn't know how to do this either, and nobody's suggestions worked until I looked at what you said about designating the workbook. For mine, in Excel 97, I had to put in ActiveWorkbook. It's all good now.

    Thanks!

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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