This is when you use the workbooks collection
code names.
ie In your template you should be using code
such as Thisworkbook. & any other workbook
you should be referencing via Activworkbook
or the workbook index and then assigning to variables.......
you should use the ThisWorkbook property to qualify any statement that must be run on the workbook you compile into the add-in. The ThisWorkbook property returns the workbook where the Visual Basic code is running. In most cases, this is the same as the active workbook. However, if the Visual Basic code is part of an add-in, the ThisWorkbook property wont return the active workbook. In this case, the active workbook is the workbook calling the add-in, whereas the ThisWorkbook property returns the add-in workbook.
Not sure if this is clear ???
Ivan