Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is the code that I had to use.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) With ThisWorkbook .IsAddin = True .Save End With End Sub I find it odd that I have to put ThisWorkbook.Save in the BeforeSave Event. If I don't change the IsAddIn property the ADD IN workbook saves just fine, but when I change the property it won't save. Could this be a bug in Excel or does Excel do this for a particular reason? What is a good resource to ask Microsoft if this is a bug? Keep in mind that the ADD IN workbook is referenced by the QUOTES workbook, thus the ADD IN workbook is hidden and contains all the code to manipulate data in QUOTES. The only thing in QUOTES is a bunch of buttons which call Subs in ADD IN. -- Cheers, Ryan "JLGWhiz" wrote: Try adding a save line in: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Cancel = False Then ThisWorkbook.IsAddin = True ThisWorkbook.Save End Sub "Ryan H" wrote in message ... I have a workbook named "QUOTES" that references another workbook named "ADD IN". ADD IN is saved as an add in, aka IsAddIn = True. I have a button in QUOTES that changes the IsAddIn property = False which exposes the ADD IN worksheets for editting by the user. Then when the user makes his edits and clicks the save button I want the IsAddIn property set back to True thus re-hidding the workbook to its orginal state. I do this in the BeforeSave Event. This is the problem. I make my edits, click save in ADD IN, the workbook is hidden and everything seems fine. But for some reason when I close QUOTES I get prompted "Do you want to save ADD IN?" If I click NO, my edits are not saved. So for some reason ADD IN isn't saving. Why? Sub cmbEditAddIn_Click() ' show add in workbook With ThisWorkbook .IsAddin = False .Activate End With End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Cancel = False Then ThisWorkbook.IsAddin = True End Sub -- Cheers, Ryan . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save Copies of Workbook with Before Save Event | Excel Programming | |||
Exiting WorkBook Save event | Excel Programming | |||
Is there a way to Trigger a Macro on a workbook save event | Excel Programming | |||
BeforeSave sub won't save another workbook when triggered by another event sub | Excel Programming | |||
Automatically run VB code on workbook save event | Excel Programming |