Creating Functions/Subroutines inside Invoke Code


I was wondering if it was possible to create custom functions or subroutines from within the Invoke Code activity?
I know that custom functions and subroutines are possible using VB.Net but I seem to keep getting error while attempting to implement the way they use inside Invoke Code.
The main errors are:
“Statement cannot appear from within a method body”
“End Sub must be preceded by a matching Sub”
I’ve read the articles about how to use Invoke Code, but I can’t seem to find a way to do this.


you should check this Invoke code activity VB.Net example

Hi @chrisL,

I didn’t make multiples functions but I think it may be possible, take a look at this : Invoke code activity Error - #5 by Masire.



Hi @chrisL
I am face the same problem?
Have you got the solution?
Best Regards!

Lambda seems to be the way to create custom functions/subroutines. See Export log from Output panel to text file - #7 by OpalSnow

If this is not a viable option for you, you will have to create custom to get the job done. See for more information.

1 Like

I can make functions\methods inside an Invoke Code Activity when using C# but not with VB.Net. Feel like there must be a way to do this for VB.Net without a custom activity. Anyone find another solution to this?