How to Run a VBA Macro in Word
The RT Client does not have a library function to directly execute a VBA macro in a Word document. RT Designer does allow you to run or inject & run a macro in MS Excel. So, the VBA code that is intended to run from a Word document can be executed via a macro in Excel.
For example, the following is the sample VBA code stored in a Word document that displays a message box.
To run the macro via RT Designer, create a dummy Excel file and use the VBA code below to call the Word function via Excel.
To run the function in RT Designer, use Library Objects > MS Office Functions > Inject And Run Excel Macro.
Note: There is also a DLL available from NICE Services that allows you to run VB scripts directly in Word documents.
Download Project Files
-
Download the project file here.
-
Unzip the files.
-
Copy the Excel and Word files to C:\TEST.
Explore the Sample
-
Open the project file in RT Designer.
-
Select Business Logic > Event Handlers to view the event with the code attached.
Test the Project
-
Run the project.
-
The event is triggered and the macro runs in Excel and calls the macro in Word.