Skip to content

Latest commit

 

History

History
52 lines (31 loc) · 1.56 KB

Excel.Application.RecordMacro.md

File metadata and controls

52 lines (31 loc) · 1.56 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Application.RecordMacro method (Excel)
vbaxl10.chm133195
vbaxl10.chm133195
Excel.Application.RecordMacro
8b6c9757-b589-04e6-5650-edfc4104e517
04/05/2019
medium

Application.RecordMacro method (Excel)

Records code if the macro recorder is on.

Syntax

expression.RecordMacro (BasicCode, XlmCode)

expression A variable that represents an Application object.

Parameters

Name Required/Optional Data type Description
BasicCode Optional Variant A string that specifies the Visual Basic code that will be recorded if the macro recorder is recording into a Visual Basic module. The string will be recorded on one line. If the string contains a carriage return (ASCII character 10, or Chr$(10) in code), it will be recorded on more than one line.
XlmCode Optional Variant This argument is ignored.

Remarks

The RecordMacro method cannot record into the active module (the module in which the RecordMacro method exists).

If BasicCode is omitted and the application is recording into Visual Basic, Microsoft Excel will record a suitable Application.Run statement.

To prevent recording (for example, if the user cancels your dialog box), call this function with two empty strings.

Example

This example records Visual Basic code.

Application.RecordMacro BasicCode:="Application.Run ""MySub"" "

[!includeSupport and feedback]