Export (0) Print
Expand All
Expand Minimize

Workbook.RunAutoMacros Method

Runs the Auto_Open, Auto_Close, Auto_Activate, or Auto_Deactivate macro attached to the workbook. This method is included for backward compatibility. You should use the Open, Close, Activate and Deactivate events instead of these macros.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public virtual void RunAutoMacros (
	XlRunAutoMacro Which
)

Parameters

Which

One of the XlRunAutoMacro values.

The following code example uses the RunAutoMacros method to run the Auto_Activate macro.

private void WorkbookRunAutoMacros()
{
    this.Activate();
    this.RunAutoMacros(Excel.XlRunAutoMacro.xlAutoActivate);
}

Show:
© 2014 Microsoft