Configuring the Automation Script Adapter with a VBA Script

You can select a Visual Basic for Applications (VBA) macro to run with the Automation Script adapter, and you can configure the arguments that are passed to the macro.

Note: The Automation Script Adapter supports macros only in Microsoft Visual Basic for Applications (MS VBA) format.

See Also
About the Automation Script Adapter
Shareable Licenses
In Other Guides
Automating Tasks Using Macros
  1. From the 3DEXPERIENCE Operations section of the action bar, click Automation Script , and drop it on the process diagram.
  2. Double-click Automation Script on the process diagram to open the Automation Script Editor.
  3. From the Script Type options, select VBA.
  4. From the Select Object options, select one of the following to specify the object on which the automation script operates:
    OptionDescription
    Content Lets you select an object (such as a physics simulation or a physical product) that is already a part of the simulation process.

    Click to search and select an object to add to the simulation process as referenced content.

    Tip: Do not select an object if the script creates an object, such as a part, and saves it on the 3DEXPERIENCE platform.
    Parameter Lets you select an object parameter that refers to an object.

    Click to search and select an object to refer to in an object parameter.

  5. From the App to open options, select the app in which to run the script.

    Note: The list of apps is controlled by the licenses that are active in your authoring session. If you do not see the required app, go to the Shareable Products page in Me > Preferences to select the required licenses.

  6. From the Macro library options, select one of the following:
    OptionDescription
    Content Lets you select a macro library that is already a part of the simulation process.

    Click to search for and select a macro library to add to the simulation process as referenced content.

    Parameter Lets you select an object parameter that refers to a macro library.

    Click to search and select a macro library to refer to in an object parameter.

  7. Optional: Next to the Macro library field, click Open macro libraries to access and manage the available macros.
    The Macros dialog box opens. From this dialog box, you can:
    • Access the Microsoft VBA editor to modify scripts.
    • Create, run, rename, and delete macros.
    For more information, see Editing a Macro
  8. Optional: Enter the Macro name, which is the name of the module that contains the macro to use with the adapter.
  9. Optional: Enter the name of the Function to use with the adapter.

    You can use user-defined functions within your script. A function is a group of reusable code that can be called anywhere in your script.

  10. Optional: To add function arguments, do the following:
    1. From the Select function argument options, select a parameter, or click Create new parameter to create a new parameter.

      The app supports parameters of types integer, real, string, and Boolean. For more information on creating a parameter, see Creating Activity Parameters.

    2. Click Add argument to add the parameter to the list of arguments to be passed to the function.
      The parameter appears in the table of arguments.

    The function arguments are the input parameters passed from an activity to a script to dynamically control its behavior. For more information, see About the Automation Script Adapter.

  11. Optional: Use the table of arguments to reorder the parameters or to delete a parameter.

    Parameters are passed to the function in the order in which they appear in the table.

  12. Optional: To capture the function's return value in a parameter, do the following:
    1. Select Capture function return in.
    2. Select a parameter from the list, or click Create new parameter to create a new parameter.

      For more information on creating a parameter, see Creating Activity Parameters.

  13. Optional: To capture an object opened or created by the script in an object parameter, do the following:
    1. Select Capture object in.
    2. Select an object parameter from the list, or click Create new parameter to create a new object parameter.

      For more information on creating a parameter, see Creating Activity Parameters.

    Note: The activity parameter's data type (real, integer, string, Boolean, or object) must be the same as the script function's return data type.

    The object parameter captures the last object opened by the script, regardless of whether the script created the object or modified the object. The app saves the object parameter automatically when the script completes or when you save the simulation process. Objects created or modified by the script might not be saved. You can include save commands in your script to save objects.
  14. From the Licensing options, select one of the following:
    OptionDescription
    Use Named User Licenses Enables access to a license tied to a specific user for at least 30 days, ensuring dedicated availability but limiting concurrent use across multiple machines.
    Use Shareable Licenses Allows dynamic allocation of a license to any user sequentially, optimizing resource usage for parallel automation workflows in on-premises environments.
  15. Click OK.