Excel Macro Output: How to send an output to UiPath?

excel
macro

#1

When I run Execute Macro, how do I set an output in my macro to be retrieved by UiPath in Macro Output?


#2

Define the macro as a function in VBA and assign the output value to the name of the function. This value will be returned to UiPath Macro Output variable

Private Function Macro1() As String
'
' Macro1 Macro'

'
    Dim Var1 As String
    Range("I4").Select
    Var1 = ActiveCell.Value

    Macro1 = Var1
End Function

Macro1 is the function name and also the return value