Quote:
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 won’t 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.
If you’ll be creating an add-in from your Visual Basic code, you
should use the ThisWorkbook property to qualify any statement
that must be run on the workbook you compile into the add-in.