Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

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

Image Removed

Parameters

...

Image Added

Settings of parameters

ParameterDescription
ContextWord-document instance where the external macro will be run.
Macro pathPath to the text file of the macro with the VBA code.
Procedure nameThe name of the called function or subprogram that is specified in the VBA code of the macro.
Input parameterValues 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

Свойство
Property
Описание
Description
Тип
Type
Пример заполнения
Filling example
Обязательность
Mandatory 
заполнения поля
field
Параметры
Parameters
Контекст
Context
Экземпляр Word-документа, в котором будет запущен внешний макрос
Instance of a Word document.Robin.WordWord context

Да

Путь к макросу

Путь к текстовому файлу макроса, который содержит VBA-код.

Путь к файлу

Да

Имя процедурыИмя вызываемой функции или подпрограммы, которая указана в VBA-коде макроса.СтрокаДаВходной параметрЗначения входных параметров вызываемой функции или подпрограммы в коде макроса. Значения параметров необходимо указывать в том же порядке, в каком эти параметры указаны в вызываемой функции.КоллекцияНет
Yes
Macro PathPath to a macro text file that contains VBA code.Robin.FilePath
Yes
Procedure nameThe name of the function or subroutine to call that is specified in the macro’s VBA code.Robin.String
Yes
Input parameterValues of input parameters of the called function or subroutine. Parameters must be specified in the same order in which these parameters are specified in the called function.Robin.Collection
No
Results
ResultThe value returned by the running macro. If the specified macro does not return anything, the result of the action will be empty.Robin.Collection
РезультатыРезультатЗначение, возвращаемое запущенным макросом. Если указанный макрос ничего не возвращает, результат работы действия будет пустым.Коллекция


Special conditions of use

  1. The "Trust access to the object model of VBA projects" checkbox must be checked in the security settings.

  2. If multiple parameters are to be specified, the user must specify a collection containing these parameters in the "Parameters" field.
  3. Parameter values must be specified in the same order in which these parameters are specified in the called function.
  4. Russian language is not supported in the macro (function) name.

Example of use

Task

There is a Word-document.

Run an external macro ReplaceEwithYo.bas in this document:

Блок кода
languagevb
titleReplaceEwithYo
Sub ReplaceEwithYo()
    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 external macro", "Save as" actions.

Implementation

  1. Assemble a robot scheme with the actions.


  2. Set the "Open document" action parameters.


  3. Set the "Run external macro" action parameters.


  4. Set the "Save as" action parameters.


  5. Click "Start" in the top panel.

Result

The action runs an external macro in the Word-file, whose VBA code is specified in a separate text file.

...