Saving an Excel File

Greg123

New Member
Joined
Apr 8, 2019
Messages
4
We have a spreadsheet on a common computer that many users input data on throughout the day. Occassionally, the spreadsheet will be left open (but not saved) at the end of the day. We have a script that moves todays file every evening into a completed folder and copies a blank file for use the next day. The script works great. However, if the last person to input data for the day does not save the file, when the script runs that evening it will copy the file but only have the data up to the last time it was saved. I have enabled autosave in Excel and set it to save every 5 minutes, but this is not actually saving the file (I believe it only makes it available for auto-recovery). Is there a way I can get the file (through excel or through a scheduled task/script) to hard save any open files to eliminate this problem?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
VBA below saves and closes workbook automatically at 7pm (if still open)
- adapt to suit your own requirements

place in ThisWorkbook module
Code:
Private Sub Workbook_Open()
    Application.OnTime TimeValue("19:00:00"), "SaveAndClose"
End Sub

place in standard module
Code:
Sub SaveAndClose()
    With ThisWorkbook
        .Save
        .Close False
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,714
Messages
6,174,048
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top