Edytuj

Udostępnij za pośrednictwem


_Application.ThisWorkbook Property

Definition

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

public:
 property Microsoft::Office::Interop::Excel::Workbook ^ ThisWorkbook { Microsoft::Office::Interop::Excel::Workbook ^ get(); };
public Microsoft.Office.Interop.Excel.Workbook ThisWorkbook { get; }
Public ReadOnly Property ThisWorkbook As Workbook

Property Value

Remarks

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 Excel. You cannot use it to access a workbook from any other application.

Applies to