Lost/incomplete file storage

jlmorris

New Member
Joined
Aug 17, 2011
Messages
1
I have written a macro to save a copy of the active workbook and reopen the original workbook so that all entries are reset to their original value for the next user. This code works well, except that once in a while the file doesn't get saved or the saved file cannot be opened. The users have not seen any error messages about this. Is there a timing issue in the code which will allow the save function to be aborted before completion or is their some other issue? Thank you.

Option Explicit
Sub SvMe()
'Saves filename as value of Last_Name First_Name plus Date_of_Birth

Dim newFile As String, fName As String, fPath As String
' Don't use "/" in date, invalid syntax
fName = Range("Last_Name").Value & " " & Range("First_Name").Value
'Change the date format to whatever you'd like, but make sure it's in quotes
newFile = fName & " " & VBA.Format$(Range("BirthDate").Value, "mm dd yyyy") & ".xlsm"
' Change directory to suit your PC, including USER NAME
fPath = "\\SignIn-PC\VaccineCenterMaster\Excel download\"
ActiveWorkbook.SaveCopyAs (fPath & newFile)
CloseMe
End Sub
Sub CloseMe()
Application.OnTime Now + TimeValue("00:00:01"), "OpenMe"
ThisWorkbook.Close False
End Sub
Sub OpenMe()
End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,224,608
Messages
6,179,872
Members
452,949
Latest member
Dupuhini

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