We have a scenario where we need to delete rows of a table dynamically in a word file. We have the macro query for it and is working fine when run in the word file.
But we need to run this query via UI Path. We did not find any activity in UI Path Studio related to Word macro.
Hello,
Not sure if you still have this problem, but thought I’d answer if you do. Unlike excel, there is no automatic Execute Macro function in uipath (Visual basic has it, but so far not uipath). So what I did was a combination of hotkeys.
First on the machine running the robot you need to have your macro installed under the normal.dot function.
To do this, open VBA under word and do an import file placing the macro under the normal directory. This allows the macro to be available to any word application running on that PC
In uipath in the word application scope:
‘send hotkey’ of ALT-F8 (this opens the macro window)
‘Run Select item ‘list’’ with your macro name
Do a Click ‘push button’ to run OK
This worked for me better then trying to work my way through the Word menu system.
I wouldn’t say this is a straightforward way to do it… But one thing you could try is to invoke some VBA code in excel, and in excel add a reference to word and by that get all the VBA functionality in word. Well, technically you don’t really have to add the reference, but writing the code is a bit easier if you do.
I have done this with Power Point and it has worked out pretty well. The following VBA code is run by invoking it in an excelfile. It adds some titles to power point slides.