Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using beforesaveas to prompt the save as screen with a pre-defined name.
When using the save button everything seems to be functioning ok as I am using Cancel = True. -When using the save as function I get the pre-defined name, however after confirming, using the save button, the screen pops up a second time. As this file needs to be sent to end-users I don't want this to happen. What can be done to avoid this? Find below the subroutine. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _ Cancel As Boolean) NameToSave = Sheet15.Cells(5, 2) & " - CDP - " & Sheet15.Cells(3, 2) & " (v" & Year(Date) & Month(Date) & Day(Date) & ")" If Sheet15.Cells(3, 2) = "" Then Answer = MsgBox("Before being able to save this file you need to select a year in the parameter sheet.", Buttons:=48) Cancel = True Sheet15.Activate Exit Sub End If If Sheet15.Cells(5, 2) = "" Then Answer = MsgBox("Before being able to save this file you need to select a country in the parameter sheet.", Buttons:=48) Cancel = True Sheet15.Activate Exit Sub End If If SaveAsUI = False Then If MsgBox("Do you really want to save this Workbook? ", vbYesNo) = vbNo Then Cancel = True Exit Sub Else Application.Dialogs(xlDialogSaveAs).Show (NameToSave) Cancel = True Exit Sub End If Else Application.Dialogs(xlDialogSaveAs).Show (NameToSave) End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Remove predefined headers | Excel Discussion (Misc queries) | |||
Combine two predefined borders | Excel Discussion (Misc queries) | |||
HelpWhy is "~$filename" 1KB copy of my saved file being created? | Excel Discussion (Misc queries) | |||
Actual Saved FileName begins with Space | Excel Programming | |||
Cycling through predefined worksheets | Excel Programming |