Private Sub Workbook_Open()
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = crFinancialsSheet Then
sheetExists = True
End If
Next
End Sub
I add the add-in, close the workbook and open a new instance of Excel.
At this point, the add-in throws an error because the ActiveWorkbook in
the Workbook_Open event is nothing and obviously there are no sheets (I
can visually see that the sheets are not there).
What I'm wondering is why the ActiveWorkbook is nothing in the
Workbook_Open event and is there another event that I can put my code.
I need the workbook to have sheets.
Thanks,
alex
http://www.cpearson.com/excel/appevent.htm
for some guidance.
--
Regards,
Tom Ogilvy
Public WithEvents App As Application
Private Sub App_Workbook_Open()
'Your Code
End Sub
And this in a normal module
Option Explicit
Public AppClass As New EventClass
And this in the "ThisWorkbook" Object:
Private Sub Workbook_Open()
Set AppClass.App = Application
End Sub
Let me know if you need help or if I'm totally off on what you're
trying to do.
Charles Chickering
alex