From Macro1 in WB1 I'm calling Macro2 in WB2. Workbook variable twb (referencing WB1) is passed with the call from WB1. Macro2 loads Userform1, then calls Userform1.getvar(twb) to pass the workbook variable into the Userform. When I enter a change, click or similar event any line referencing twb provides the "object not set" error. I need a way to be able to pass the twb reference after button clicks, change events, etc.
When I was using a single Macro in a single WB, I set twb as a public variable and it was available in all the Userform subroutines. When I call Macro2 from Macro1, the public variables are not working.
I'm trying to create a "code engine" that will be utilized by any of 12 different WBs. WB2 is essentially a blank workbook with the necessary code. WB1 contains data customized to that entity, in this case County.