What is the difference between ThisWorkbook and ActiveWorkbook in VBA. It is common to see two references to a Workbook in VBA – the first and most common is the ActiveWorkbook object and the second is ThisWorkbook.
If the code is running code in the same workbook these will act identically because both will keep pointing at the same Workbook. However, when you are referencing multiple workbooks you will run into problems referencing the wrong workbook.
So what is the difference
The ActiveWorkbook is last used workbook or the workbook you are currently working in. In other words, you may have many workbooks that are visible but Windows only views on of those visible workbooks the active workbook. Therefore Excel considers the Active workbook that currently selected is considered or Active.
The ThisWorkbook property is easy. It is the workbook that the code is executing from. It is the parent workbook from which the code is stored. Specifically it will return the Workbook object that represents the workbook where the current macro code is running.
Tags: What is the difference between ThisWorkbook and ActiveWorkbook in VBA, thisworkbook name activeworkbook name, thisworkbook activeworkbook vba, thisworkbook activeworkbook, thisworkbook.name vba, thisworkbook vba, thisworkbook, activeworkbook, activeworkbook vba, excel vba, workbook, msexcel, tutorial, thisworkbook module, thisworkbook vs activeworkbook, what is vba, thisworkbook vs module, everydayvba, activeworkbook vs thisworkbook, macros, vba, excel