![]() |
Save Copy Problem
When an excel file (read only) is loaded and then the user goes to save it.
It then asks the user to save a copy. How do I prevent this from popping up? I thought of Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.DisplayAlerts = False ActiveWorkbook.Close (SaveChanges = False) End Sub But I'm not sure if it always works and if its good to remove display alerts Is this the correct way to do this? Thanks, |
Save Copy Problem
Thanks for your help. Only one more thing how do I save the workbook as
everytime I try and save it goes to the BeforeSave procedure? Thanks, "Norman Jones" wrote: Hi Biker, Try: '============= Private Sub Workbook_BeforeClose(Cancel As Boolean) Me.Saved = True End Sub '--------------- Private Sub Workbook_BeforeSave(ByVal SaveAsUI _ As Boolean, Cancel As Boolean) Cancel = True End Sub '<<============= --- Regards, Norman "biker" wrote in message ... When an excel file (read only) is loaded and then the user goes to save it. It then asks the user to save a copy. How do I prevent this from popping up? I thought of Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.DisplayAlerts = False ActiveWorkbook.Close (SaveChanges = False) End Sub But I'm not sure if it always works and if its good to remove display alerts Is this the correct way to do this? Thanks, |
Save Copy Problem
One way:
Hit alt-f11 to get to the vbe hit ctrl-r to see the immediate window type this: application.enableevents = false Back to excel to save the workbook Back to the VBE to reenable events Hit alt-f11 to get to the vbe hit ctrl-r to see the immediate window type this: application.enableevents = True ========= Note that any user can do this, too! biker wrote: Thanks for your help. Only one more thing how do I save the workbook as everytime I try and save it goes to the BeforeSave procedure? Thanks, "Norman Jones" wrote: Hi Biker, Try: '============= Private Sub Workbook_BeforeClose(Cancel As Boolean) Me.Saved = True End Sub '--------------- Private Sub Workbook_BeforeSave(ByVal SaveAsUI _ As Boolean, Cancel As Boolean) Cancel = True End Sub '<<============= --- Regards, Norman "biker" wrote in message ... When an excel file (read only) is loaded and then the user goes to save it. It then asks the user to save a copy. How do I prevent this from popping up? I thought of Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.DisplayAlerts = False ActiveWorkbook.Close (SaveChanges = False) End Sub But I'm not sure if it always works and if its good to remove display alerts Is this the correct way to do this? Thanks, -- Dave Peterson |
All times are GMT +1. The time now is 01:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com