Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Using Office 2003 and Windows XP;
I am trying to trap the Workbook_BeforeClose event so that I can substitute a call to my own save function, see below: Public Function FileSavePrompt(argPath As String, argName As String) As Long 'SUPPLY A DEFAULT FILE NAME AND PROMPT THE USER TO SAVE THE FILE; Application.ScreenUpdating = True Dim lResponse As Long With Application.FileDialog(msoFileDialogSaveAs) .AllowMultiSelect = False .ButtonName = "SAVE!" .InitialView = msoFileDialogViewDetails .InitialFileName = argPath & argName .Title = "SAVE FILE AS EXCEL" End With lResponse = Application.FileDialog(msoFileDialogSaveAs).Show 'Save the file if user did not click 'Cancel' If lResponse = -1 Then Application.FileDialog(msoFileDialogSaveAs).Execut e End Function This function allows me to capture and enter a custom suggested file name for the user. However, I cannot get this to function correctly. In many cases, it errors so badly, I get the: "Do you want to send this error to Microsoft" message. Can someone tell me how to invoke this correctly? I've tried all combinations of Cancel = True and Application.EnableEvents = False, but I must not be putting my code in the right place or something. Any help appreciated. Thanks much in advance. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Trap the Send-To event | Excel Programming | |||
How to trap the worksheet_BeforeDeactivate event? | Excel Programming | |||
How to trap delete row event and hide column event? | Excel Programming | |||
Don't save before close event? | Excel Programming |