Return variable value from invoked VBA code

Hi guys,

I’m currently using Invoke VBA code, in order to run a macro over some excel files. This code is supposed to return a value, which I would like to use in the UiPath workflow.
In order to achieve this, I’ve created an object variable and set it in the result field of the Invoke VBA code activity.
The problem is that I’m not sure how to link the VBA internal variable to the external one.
Can someone please assist?

Thank you,
Razvan Sodoleanu

2 Likes

I have done the simple code here.

  1. image
  2. image

Value of"Test" in VBA comes to “output” in Uipath

2 Likes

Thank you for the answer, but I’m looking for getting the values from a VBA code, not normal VB code. The Invoke VBA is an activity which invokes code from a .bas file, and is slightly different to the Invoke code activity.

1 Like

can check whether it is helpful

Thank you for the answer. The issue is how to get the value from inside the VBA code, into the output variable of the UiPath activity. The return value of the function I was able to get into another variable, but still inside of the VBA file, and nothing gets passed to the UiPath workflow.

  1. image

  2. Properties
    image

  3. As shown in above link (Excel VBA Function Tutorial: Return, Call, Examples) I have done below sample code:


    It is giving be output by bot

5 Likes

That solved it. Thank you very much.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.