How to execute VBA function in MS Word?


#1

Hello.

I would like to know if it is possible to run VBA function with parametr in MS Word,
eg.

Public Function Test (sTestString As String)
ActiveDocument.Range.Paragraphs(1).Range.Text = sTestString
End Function

Regards,
Maciej


#2

This doesn’t sound like a UIpath query. Please refer below link:

https://msdn.microsoft.com/en-us/library/office/ff604039(v=office.14).aspx


#3

Not easily at present although you could physically open the Word document and execute the macro.

Coming soon is the ability to write bespoke code in UiPath which would also allow the creation of VB.Net functions that could complete the same task.

@badita probably worth considering an Execute Macro activity for MSWord as there may already be complex macros in a Word document that you need to call.

Richard


MS Word change page orientation