Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

_Application.ThisWorkbook Property 

Returns a Workbook object that represents the workbook where the current macro code is running.

Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in microsoft.office.interop.excel.dll)

'Usage
Dim _Application1 As _Application

Dim returnValue As Workbook
returnValue = _Application1.ThisWorkbook

Workbook ThisWorkbook {get;}
public Workbook get_ThisWorkbook();
function get ThisWorkbook() : Workbook;

Use this property to refer to the workbook that contains your macro code. ThisWorkbook is the only way to refer to an add-in workbook from inside the add-in itself. The ActiveWorkbook property doesn't return the add-in workbook; it returns the workbook that's calling the add-in. The Workbooks property may fail, because the workbook name probably changed when you created the add-in. ThisWorkbook always returns the workbook in which the code is running.

This property can be used only from inside Microsoft Excel. You cannot use it to access a workbook from any other application.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.