+ Reply to Thread
Results 1 to 4 of 4

Eliminating Save Dialog but still Saving Excel File

Hybrid View

  1. #1
    Registered User
    Join Date
    11-02-2006
    Posts
    11

    Eliminating Save Dialog but still Saving Excel File

    Hi ALL

    I have managed to make backup copies under dates and times before closing excel each time by using the following statement:

    ThisWorkbook.SaveCopyAs "C:\Backup\" & "Backup_" & Format(Now, "DDMMYYYY-HHMM") & ".xls"
    However, this is insufficient - I would like to eliminate the 'save dialog' before closing and I achieved this by using the following statement:

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ThisWorkbook.Close False
    End Sub
    Now, this is not ideal as it will not save the sheet - what I would like is to save the sheet on closing without Excel asking the user to save changes. Is this possible by any chance? If so, how? Thanks

    Usman


    Usman

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
        Me.Save
    End Sub
    This is very dangerous; if a user accidentally deletes a sheet, for example, he can no longer exit without saving.

  3. #3
    Registered User
    Join Date
    11-02-2006
    Posts
    11

    Talking Dynamic Data Protection

    Hi

    Thanks!

    I used:

    ThisWorkbook.Save
    ThisWorkbook.Saved = True

    In order to accidentally protect the sheet from such problems - I felt it would be ideal to protect the new data that has been inputted (like a dynamic protection of data so to speak)? So if I enter something this week, I will not be able to make changes (whether accidental or not) to previous data i.e including that entered last week?

    This way, it is safer and I also have a backup of the excel sheet each time it is closed plus it is automatically saved (without user intervention).

    Any ideas on dynamic protection anyone? Thanks

    Usman

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    ThisWorkbook.Save
    ThisWorkbook.Saved = True
    The first statement is the same as mine in the context of the ThisWorkbook module, and the second is redundant, but sure, that's fine.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. select File Open Dialog Box
    By izet99 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-28-2008, 03:39 AM
  2. Message box upon saving excel file
    By JuzMe in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-12-2008, 05:30 AM
  3. Saving excel file with VBScript
    By JuzMe in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-12-2008, 02:36 AM
  4. Excel file won't save
    By jdtate51 in forum Excel General
    Replies: 1
    Last Post: 01-17-2008, 06:42 PM
  5. Excel 2007 file save problems
    By JVD in forum Excel General
    Replies: 1
    Last Post: 01-15-2008, 04:48 PM

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