Not able to add connect word with excel using VBA

Hi All,

I am trying to search for a word in MSWord document and reading the whole line of that word and writing it into the excel. I am trying it using VBA code.

Here the issue is adding reference for word in excel. I am able to add the reference by the code manually. But when i am trying to run the same code from uipath, it is not adding.
If i open the excel application scope from uipath, that reference option is disabled.

Can anyone help me on this please?

Thanks in advance!!

Regards,
Narmatha

Please refer the following link for reference