PKFillmore
New Member
- Joined
- Apr 3, 2012
- Messages
- 24
Hi there folks,
its been awhile since I posted anything so if I did anything wrong please let me know.
Ok to give some background... I have a bunch of code located in an addin which opens whenever I open excel. The addin contains a custom ribbon ui with various buttons doing various things...
A problem I am experiencing is when a user opens excel (a blank unsaved workbook ie 'book1') then uses one of the features of the addin. Each feature calls a logbook for stats purposes, When the logbook closes it closes both the logbook as well as the unsaved workbook 'book1' . this causes the next part of the code to fail since book1 is no longer open.
Even if I have more than 1 workbook open, it always closes the unsaved workbook.
Can anyone provide a little insight?
Thanks
its been awhile since I posted anything so if I did anything wrong please let me know.
Ok to give some background... I have a bunch of code located in an addin which opens whenever I open excel. The addin contains a custom ribbon ui with various buttons doing various things...
A problem I am experiencing is when a user opens excel (a blank unsaved workbook ie 'book1') then uses one of the features of the addin. Each feature calls a logbook for stats purposes, When the logbook closes it closes both the logbook as well as the unsaved workbook 'book1' . this causes the next part of the code to fail since book1 is no longer open.
Even if I have more than 1 workbook open, it always closes the unsaved workbook.
Can anyone provide a little insight?
Thanks
Code:
Sub x()
'code...
'Open Logbook
Workbooks.Open filename:=LogBook
'more code... (input log data...)
'close logbook
ActiveWorkbook.Save
ActiveWorkbook.Close
'more code... (uses cells references which fail since the unsaved workbook closes)
End Sub