Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in RPA by (5.3k points)
recategorized by

I am trying to return an object from function Find123. I have called it from sub procedure Retrieve123.

When I comple it says function not defined and it highlights the CObj method.

Could you tell me a way to convert integer or string into object and return it in VBA?

Sub Retrieve123() Call Find123() End Sub Function Find123()As Object Dim val As String val="100" Dim obj As Object Set obj=CObj(val) Set Find123 = obj End Function

This is how I get the error message enter image description here

When I assign the string value into the function it gives this type mismatch error.

enter image description here

I need to convert the string into object because in UiPath we can only return type object as the Invoke VBA activity's output is object type.

1 Answer

0 votes
by (9.5k points)

 As i would say , you don't have to convert anything to an object, as  UiPath treats return values from the invoke vba activity as objects .

You can  return a primitive type from your function that is an integer 

 work on storing it in a object-typed variable in UiPath, and then cast it to integer again.

Type Conversion in UiPath

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...