Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to put some code in the BeforeSave event so that when the user
tries to save the workbook they will be prompted with the Save As dialog with a different file name so they do not save over the original file. I am using the SafeFileAs function and the Save As dialog does appear but the initial directory is set to My Documents and I would like it to be set to something else. Below is the code that I am using. Can anyone tell me how I can accomplish this? Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim DialogResult As String Dim UserFileName As String Dim sAppPath As String Application.EnableEvents = False sAppPath = ActiveWorkbook.Path & "\Bone Match 5.0 Template Directory\Bone Match 5.0 History\BoneMatch.xls" DialogResult = Application.GetSaveAsFilename(InitialFileName:=sAp pPath, FileFilter:="Microsoft Office Excel Workbook (*.xls), *.xls") If DialogResult = "False" Then Application.EnableEvents = True Cancel = True Exit Sub End If UserFileName = CStr(DialogResult) Workbook.SaveAs (UserFileName) Application.EnableEvents = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save as dialog | Excel Discussion (Misc queries) | |||
how to get disk icon on save button of save as dialog like 2000 | Excel Discussion (Misc queries) | |||
Changing Save As Type in Save as dialog box | Excel Programming | |||
Save As Dialog | Excel Programming | |||
Save As Dialog | Excel Programming |