+ Reply to Thread
Results 1 to 3 of 3

Setting Workbook Changed Indicator

  1. #1
    Jack Gillis
    Guest

    Setting Workbook Changed Indicator

    I need to set whatever indicator or key used by Excel that tells it a
    workbook has been changed and prevents it from closing without asking if
    I want to save it. Some of my macros make temporary appearance changes
    to the workbook that I do not ever want to save and I would like to
    reset the indicator so that when click on the 'red X', Excel will close.

    I'm not sure if I have made my question clear.

    Thank you very much.



  2. #2
    Dave Peterson
    Guest

    Re: Setting Workbook Changed Indicator

    You could just set the .saved flag to true at the end of your code, but if the
    user (you??) actually made changes that need to be saved, you won't be reminded.

    Maybe it would be better to save that status, run your code and change the
    status back to what it was:

    Option Explicit
    Sub testme()

    Dim mySavedStatus As Boolean

    mySavedStatus = ActiveWorkbook.Saved
    'your macro here
    ActiveCell.Value = 100000
    ActiveWorkbook.Saved = mySavedStatus

    MsgBox ActiveWorkbook.Saved
    End Sub


    Activeworkbook.saved = true
    is one way of just overriding that flag. (But I'd still be careful with that.)



    Jack Gillis wrote:
    >
    > I need to set whatever indicator or key used by Excel that tells it a
    > workbook has been changed and prevents it from closing without asking if
    > I want to save it. Some of my macros make temporary appearance changes
    > to the workbook that I do not ever want to save and I would like to
    > reset the indicator so that when click on the 'red X', Excel will close.
    >
    > I'm not sure if I have made my question clear.
    >
    > Thank you very much.


    --

    Dave Peterson

  3. #3
    Jack Gillis
    Guest

    Re: Setting Workbook Changed Indicator


    "Dave Peterson" <[email protected]> wrote in message
    news:[email protected]...
    > You could just set the .saved flag to true at the end of your code,
    > but if the
    > user (you??) actually made changes that need to be saved, you won't be
    > reminded.
    >
    > Maybe it would be better to save that status, run your code and change
    > the
    > status back to what it was:
    >
    > Option Explicit
    > Sub testme()
    >
    > Dim mySavedStatus As Boolean
    >
    > mySavedStatus = ActiveWorkbook.Saved
    > 'your macro here
    > ActiveCell.Value = 100000
    > ActiveWorkbook.Saved = mySavedStatus
    >
    > MsgBox ActiveWorkbook.Saved
    > End Sub
    >
    >
    > Activeworkbook.saved = true
    > is one way of just overriding that flag. (But I'd still be careful
    > with that.)
    >


    Thank you, Dave. That is good advice.

    Jack

    >
    >
    > Jack Gillis wrote:
    >>
    >> I need to set whatever indicator or key used by Excel that tells it a
    >> workbook has been changed and prevents it from closing without asking
    >> if
    >> I want to save it. Some of my macros make temporary appearance
    >> changes
    >> to the workbook that I do not ever want to save and I would like to
    >> reset the indicator so that when click on the 'red X', Excel will
    >> close.
    >>
    >> I'm not sure if I have made my question clear.
    >>
    >> Thank you very much.

    >
    > --
    >
    > Dave Peterson





+ 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