Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is the problem...I tell the workbook where to save and with what name
using code, part of the file name is a date entered by the user. If the user enters the same date then I want to give them the option of overwriting the file or canceling the save. I have tried the following code and can't get it to work properly. It works great if I put in Application.DisplayAlerts = False and just allow it to overwrite the existing file, but if there is already a lot of info in that file that would not be good. I would like it to be a critical message and they can either choose yes or no, if they choose yes then it would resume the save, if no then I will put some code in so that certain sheets are shown. Any help is greatly appreciated. On Error GoTo SaveOrNot ActiveWorkbook.SaveAs Filename:= _ myFileName, FileFormat:=xlNormal, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False MsgBox "File Saved to " & myFileName End If Application.ScreenUpdating = True SaveOrNot: Dim Res As Long Res = MsgBox("A File With This Name Already Exists In This Location! Do You Want To Replace It?", vbYesNo) If Res = 6 Then Resume ElseIf Res = 7 Then End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Custom Views Error Message | Excel Discussion (Misc queries) | |||
replace VBA run-time error message with custom message | Excel Programming | |||
Custom error-message for MatchRequired ComboBox | Excel Programming | |||
Replace Excel Message w/Custom Message | Excel Programming | |||
Why error message when trying to display custom view? | Excel Discussion (Misc queries) |