Run macro Version 1 (Net)
Action group: Word
Description
The action runs the specified macro in the Word-document.
More about interacting with macro:
Action icon
Settings of parameters
Parameter | Description |
---|---|
Context | Word-document instance where the macro will be run. |
Macro name | Name of the macro that will be run. |
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Context | The instance of the Word document. | Robin.Word | Word context | Yes |
Macro name | The name of the macro to be run. | Robin.String | Yes |
Special conditions of use
The macro must be created in Word beforehand.
To begin, create a Word-document.
To do this:
- Open MS Word, go to "File" and then "Parameters".
- In the open window "Word parameters" click on "Customize feed".
- Scroll down the list and check the checkbox "Developer".
- In the toolbar go either to the "Developer" tab or to the "Macros" tab - there you can run built-in (created) macros inside the document. In the "Visual Basic" tab you can create new macros.
- Click on the 3rd tab to get to the panel for creating macros.
- Click right mouse button on the 1 element, select Insert -> Module.
This way you can either create your own macro or paste a ready-made one into this field and save it using CTRL+S.
Example of use
Task
There is a Word-document:
Run macro that swaps words.
ReplaceИзбаWithДом
Sub ReplaceИзбаWithДом() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "Изба" .Replacement.Text = "Дом" .Forward = True .Wrap = wdFindAsk .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
Solution
Use the "Open document", "Run Macro", "Save as" actions.
Реализация
Assemble a robot scheme with the actions:
- Move the "Open document" action to the workspace.
- Move the "Run Macro" action to the workspace.
- Move the "Save as" action to the workspace.
- Move the "Close document" action to the workspace.
- Click "Start" in the top panel to start the robot.
Result
The program robot completed successfully.
The document contains the result of the macro execution.
Обзор
Инструменты контента