Run external macro Version 1 (Net)
Action group: Word
Description
The action runs a macro in a Word-document whose VBA code is specified in a separate text file.
Find more about working with macro here:
Action icon
Parameters
Input parameters
Parameter | Description |
---|---|
Context | Word-document instance where the external macro will be run. |
Macro path | Path to the text file of the macro with the VBA code. |
Procedure name | The name of the called function or subprogram that is specified in the VBA code of the macro. |
Input parameter | Values of input parameters of the called function or subprogram in the macro code. The values of parameters must be specified in the same order in which these parameters are specified in the called function. |
Output parameters
Result - the value returned by the running macro. If the specified macro returns nothing, the result of the action will be empty.
Settings of parameters
Свойство | Описание | Тип | Пример заполнения | Обязательность заполнения поля |
Параметры | ||||
Контекст | Экземпляр Word-документа, в котором будет запущен внешний макрос. | Robin.Word | Да | |
Путь к макросу | Путь к текстовому файлу макроса, который содержит VBA-код. | Путь к файлу | Да | |
Имя процедуры | Имя вызываемой функции или подпрограммы, которая указана в VBA-коде макроса. | Строка | Да | |
Входной параметр | Значения входных параметров вызываемой функции или подпрограммы в коде макроса. Значения параметров необходимо указывать в том же порядке, в каком эти параметры указаны в вызываемой функции. | Коллекция | Нет | |
Результаты | ||||
Результат | Значение, возвращаемое запущенным макросом. Если указанный макрос ничего не возвращает, результат работы действия будет пустым. | Коллекция |
Special conditions of use
- The "Trust access to the object model of VBA projects" checkbox must be checked in the security settings.
- If multiple parameters are to be specified, the user must specify a collection containing these parameters in the "Parameters" field.
- Parameter values must be specified in the same order in which these parameters are specified in the called function.
- Russian language is not supported in the macro (function) name.
Example of use
Task
There is a Word-document. Run an external macro in this document.
Solution
Use the "Open document", "Run external macro", "Save as", "Close document" actions. Для реализации действия нужны следующие действия - «Открыть», «Запустить внешний макрос».
Реализация
- Собрать робота, состоящего из следующих действий:
- Настроить параметры для действия «Открыть».
- Настроить параметры для действия «Запустить внешний макрос».
- Настроить параметры действия "Сохранить как".
- Настроить параметры действия "Закрыть".
- Нажать на кнопку «Старт» в верхней панели.
Результат
Действие запускает в Word-файле внешний макрос, VBA-код которого указан в отдельном текстовом файле.