Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I switched my personal.xls file to an add-in, .xla and when I exit Excel, I
am not prompted to save changes to the .xla file and sometimes, if I forget, I lose changes. Is there a way to put something in the "Workbook_BeforeClose" sub that will save the changes to the add-in? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In the ThisWorkbook module, use code like the following in the BeforeClose
event. With Application .EnableEvents = False ThisWorkbook.Save .EnableEvents = True End With -- Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2008 Pearson Software Consulting, LLC www.cpearson.com (email on web site) "MikeH2" wrote in message ... I switched my personal.xls file to an add-in, .xla and when I exit Excel, I am not prompted to save changes to the .xla file and sometimes, if I forget, I lose changes. Is there a way to put something in the "Workbook_BeforeClose" sub that will save the changes to the add-in? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Application.DisplayAlerts = False ActiveWorkbook.Save -- If this posting was helpful, please click on the Yes button. Regards, Michael Arch. "MikeH2" wrote: I switched my personal.xls file to an add-in, .xla and when I exit Excel, I am not prompted to save changes to the .xla file and sometimes, if I forget, I lose changes. Is there a way to put something in the "Workbook_BeforeClose" sub that will save the changes to the add-in? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your solution did not seem to work but the one submitted before did:
With Application .EnableEvents = False ThisWorkbook.Save .EnableEvents = True End With Not sure why but I hope this solves the problem. "Michael" wrote: Application.DisplayAlerts = False ActiveWorkbook.Save -- If this posting was helpful, please click on the Yes button. Regards, Michael Arch. "MikeH2" wrote: I switched my personal.xls file to an add-in, .xla and when I exit Excel, I am not prompted to save changes to the .xla file and sometimes, if I forget, I lose changes. Is there a way to put something in the "Workbook_BeforeClose" sub that will save the changes to the add-in? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You may want to add a prompt to Chip's suggested code.
If you're screwing around and delete multiple modules/routines, you may not want to make it automatic. Dim Resp as long if me.saved = true then 'do nothing else resp = msgbox(Prompt:="Wanna save your changes?", buttons:=vbyesno) if resp = vbyes then With Application .EnableEvents = False me.Save 'me is ok, since the code is under the ThisWorkbook module .EnableEvents = True end with end if End With (Untested, uncompiled--watch for typos.) My personal preference is to not to do any development work in my personal.xla file. I'll do all my testing in a separate workbook, then when I'm happy, I'll move the code into my personal.xla. Then I'll just save manually. I keep my personal.xla file marked readonly, too. Just to make it more difficult for me to screw it up. MikeH2 wrote: I switched my personal.xls file to an add-in, .xla and when I exit Excel, I am not prompted to save changes to the .xla file and sometimes, if I forget, I lose changes. Is there a way to put something in the "Workbook_BeforeClose" sub that will save the changes to the add-in? -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You final suggestion about doing testing elsewhere is probably the best
approach to this entire issue. That is what I'll do. Thanks! "Dave Peterson" wrote: You may want to add a prompt to Chip's suggested code. If you're screwing around and delete multiple modules/routines, you may not want to make it automatic. Dim Resp as long if me.saved = true then 'do nothing else resp = msgbox(Prompt:="Wanna save your changes?", buttons:=vbyesno) if resp = vbyes then With Application .EnableEvents = False me.Save 'me is ok, since the code is under the ThisWorkbook module .EnableEvents = True end with end if End With (Untested, uncompiled--watch for typos.) My personal preference is to not to do any development work in my personal.xla file. I'll do all my testing in a separate workbook, then when I'm happy, I'll move the code into my personal.xla. Then I'll just save manually. I keep my personal.xla file marked readonly, too. Just to make it more difficult for me to screw it up. MikeH2 wrote: I switched my personal.xls file to an add-in, .xla and when I exit Excel, I am not prompted to save changes to the .xla file and sometimes, if I forget, I lose changes. Is there a way to put something in the "Workbook_BeforeClose" sub that will save the changes to the add-in? -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
And keep plenty of backups!
MikeH2 wrote: You final suggestion about doing testing elsewhere is probably the best approach to this entire issue. That is what I'll do. Thanks! "Dave Peterson" wrote: You may want to add a prompt to Chip's suggested code. If you're screwing around and delete multiple modules/routines, you may not want to make it automatic. Dim Resp as long if me.saved = true then 'do nothing else resp = msgbox(Prompt:="Wanna save your changes?", buttons:=vbyesno) if resp = vbyes then With Application .EnableEvents = False me.Save 'me is ok, since the code is under the ThisWorkbook module .EnableEvents = True end with end if End With (Untested, uncompiled--watch for typos.) My personal preference is to not to do any development work in my personal.xla file. I'll do all my testing in a separate workbook, then when I'm happy, I'll move the code into my personal.xla. Then I'll just save manually. I keep my personal.xla file marked readonly, too. Just to make it more difficult for me to screw it up. MikeH2 wrote: I switched my personal.xls file to an add-in, .xla and when I exit Excel, I am not prompted to save changes to the .xla file and sometimes, if I forget, I lose changes. Is there a way to put something in the "Workbook_BeforeClose" sub that will save the changes to the add-in? -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save, save as, page setup dimmed out in unprotected excel sheet? | Excel Discussion (Misc queries) | |||
Disable save, save as, but allow save via command button | Excel Programming | |||
How to diasble save and save as menu but allow a save button | Excel Programming | |||
how to get disk icon on save button of save as dialog like 2000 | Excel Discussion (Misc queries) | |||
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: | Excel Programming |