Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following code snippet works fine in Excel 2003, but XP behaviour is
different. In Excel XP I get prompted to save the file twice. Any ideas - TIA Dave Private Sub m_ThisApplication_WorkbookBeforeSave(ByVal Wb As Microsoft.Office.Interop.Excel.Workbook, ByVal SaveAsUI As Boolean, ByRef Cancel As Boolean) Handles m_ThisApplication.WorkbookBeforeSave If SaveAsUI Then sBeforeSaveFilename = Wb.Name m_ThisApplication.EnableEvents = False m_ThisApplication.Dialogs(xlDialogSaveAs).Show() ' prevent a second save m_ThisApplication.EnableEvents = True Cancel = True End If Wb = Nothing |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
it is not the enable events method that you turn off, it's the display alerts
method that you turn off. Alternatively, set the workbooks SAVED property to TRUE. "Dave McL." wrote: The following code snippet works fine in Excel 2003, but XP behaviour is different. In Excel XP I get prompted to save the file twice. Any ideas - TIA Dave Private Sub m_ThisApplication_WorkbookBeforeSave(ByVal Wb As Microsoft.Office.Interop.Excel.Workbook, ByVal SaveAsUI As Boolean, ByRef Cancel As Boolean) Handles m_ThisApplication.WorkbookBeforeSave If SaveAsUI Then sBeforeSaveFilename = Wb.Name m_ThisApplication.EnableEvents = False m_ThisApplication.Dialogs(xlDialogSaveAs).Show() ' prevent a second save m_ThisApplication.EnableEvents = True Cancel = True End If Wb = Nothing |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
By leaving EnableEvents on the event "WorkbookBeforeSave" will get fired
twice, creating the same problem. Application.ActiveWorkbook.Saved is set to true by "m_ThisApplication.Dialogs(xlDialogSaveAs).Show()" . Setting display alerts to false had no effect. Cheers Dave "Patrick Molloy" wrote: it is not the enable events method that you turn off, it's the display alerts method that you turn off. Alternatively, set the workbooks SAVED property to TRUE. "Dave McL." wrote: The following code snippet works fine in Excel 2003, but XP behaviour is different. In Excel XP I get prompted to save the file twice. Any ideas - TIA Dave Private Sub m_ThisApplication_WorkbookBeforeSave(ByVal Wb As Microsoft.Office.Interop.Excel.Workbook, ByVal SaveAsUI As Boolean, ByRef Cancel As Boolean) Handles m_ThisApplication.WorkbookBeforeSave If SaveAsUI Then sBeforeSaveFilename = Wb.Name m_ThisApplication.EnableEvents = False m_ThisApplication.Dialogs(xlDialogSaveAs).Show() ' prevent a second save m_ThisApplication.EnableEvents = True Cancel = True End If Wb = Nothing |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
WorkbookBeforeSave Problem | Excel Discussion (Misc queries) | |||
Handling WorkbookBeforeClose and WorkbookBeforeSave | Excel Programming |