DoCmd.RunMacro method (Access)
The RunMacro method carries out the RunMacro action in Visual Basic.
Syntax
expression.RunMacro (MacroName, RepeatCount, RepeatExpression)
expression A variable that represents a DoCmd object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
MacroName | Required | Variant | A string expression that's the valid name of a macro in the current database. If you run Visual Basic code containing the RunMacro method in a library database, Microsoft Access looks for the macro with this name in the library database and doesn't look for it in the current database. |
RepeatCount | Optional | Variant | A numeric expression that evaluates to an integer, which is the number of times the macro will run. |
RepeatExpression | Optional | Variant | A numeric expression that's evaluated each time the macro runs. When it evaluates to False (0), the macro stops running. |
Remarks
Use the RunMacro method to run a macro.
Use MacroGroupName.MacroName syntax for the MacroName argument to run a particular macro in a macro group.
If you specify the RepeatExpression argument and leave the RepeatCount argument blank, you must include the RepeatCount argument's comma. If you leave a trailing argument blank, don't use a comma following the last argument that you specify.
Example
The following example runs the macro Print Sales that will print the sales report twice.
DoCmd.RunMacro "Print Sales", 2
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기