+ Reply to Thread
Results 1 to 3 of 3

Check to see if excel file has been saved

  1. #1
    ExcelMonkey
    Guest

    Check to see if excel file has been saved

    How do you check if an excel file has been saved in VBA? That is, if I have
    an excel file open, what property tells me if the file has been saved yet?

    I am thinking of an instance where I open a new workbook and forget to save
    it. I want to run a macro that tells me that although the file is open, it
    has not been saved yet.

    Thanks

  2. #2
    Gareth
    Guest

    Re: Check to see if excel file has been saved

    activeworkbook.saved (true or False)

    G

    ExcelMonkey wrote:
    > How do you check if an excel file has been saved in VBA? That is, if I have
    > an excel file open, what property tells me if the file has been saved yet?
    >
    > I am thinking of an instance where I open a new workbook and forget to save
    > it. I want to run a macro that tells me that although the file is open, it
    > has not been saved yet.
    >
    > Thanks


  3. #3
    Mike Fogleman
    Guest

    Re: Check to see if excel file has been saved

    From VBA Help for "Saved":

    Saved Property Example

    This example displays a message if the active workbook contains unsaved
    changes.

    If Not ActiveWorkbook.Saved Then
    MsgBox "This workbook contains unsaved changes."
    End IfThis example closes the workbook that contains the example code and
    discards any changes to the workbook by setting the Saved property to True.

    ThisWorkbook.Saved = True
    ThisWorkbook.CloseMike F"ExcelMonkey"
    <[email protected]> wrote in message
    news:[email protected]...
    > How do you check if an excel file has been saved in VBA? That is, if I
    > have
    > an excel file open, what property tells me if the file has been saved yet?
    >
    > I am thinking of an instance where I open a new workbook and forget to
    > save
    > it. I want to run a macro that tells me that although the file is open,
    > it
    > has not been saved yet.
    >
    > Thanks




+ 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