Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Problems with Workbook Before Save Event

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save Copies of Workbook with Before Save Event RyanH Excel Programming 1 October 27th 08 03:13 PM
Exiting WorkBook Save event Richard Buttrey Excel Programming 3 July 29th 05 06:23 PM
Is there a way to Trigger a Macro on a workbook save event Dan Gardner Excel Programming 1 January 19th 05 02:20 AM
BeforeSave sub won't save another workbook when triggered by another event sub Brad Yundt Excel Programming 1 June 3rd 04 03:12 AM
Automatically run VB code on workbook save event Tim[_32_] Excel Programming 2 December 10th 03 08:06 PM


All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"