I have an Excel macro that creates a new custom workbook with events. The macro also copies the .bas and .cls files onto the new workbook and changes the link to be the new workbook.
When the new workbook is created, everything, including events works fine. But when I close it and reopen it, the events do not work anymore. I realize the new workbook value is been lost. Since I have a button on the sheet I added the following to try to recreate it but no luck:
Dim Newbook As New eventWB
Dim thisWB As Workbook
Set Newbook.Workbook = ActiveWorkbook
Set thisWB = Newbook.Workbook
// extra code to gather information
Worksheet_Change
event know to fire if I change a cell onSheet1
in the new workbook if the code is in the class module? – Scott HoltzmanWorkbooks.Add
to create a new workbook and then copy your code modules/classes over to it. On a sheet in the new workbook, you have the code listed above (which creates an object of your custom event class). If you close all workbooks and then open the macro-created workbook, events do not work. Is this correct? – PeterT