# Invoke Code - Compile Functions

**URL:** <https://forum.uipath.com/t/invoke-code-compile-functions/230189>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [June 10, 2020, 8:11pm UTC](https://forum.uipath.com/t/invoke-code-compile-functions/230189 "2020-06-10T20:11:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![purplemouse651](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@purplemouse651](https://forum.uipath.com/u/purplemouse651)\
**Post date:** [June 10, 2020, 8:11pm UTC](https://forum.uipath.com/t/invoke-code-compile-functions/230189/1 "2020-06-10T20:11:14Z")

</div>

The “invoke code” element seems to be an invisible “Private Sub …” Statement in which you can throw your code, is that right?

Is it possible to use and run more complex [VB.net](http://VB.net) code in UiPath?

```
Private Iterator Function Tokens(ByVal phrase As String) As IEnumerable(Of String)
	...
End Function

Private Function subCompile(ByVal te As IEnumerator(Of String), ByVal g As ParameterExpression) As Expression
	Return ...
End Function

Public Function Compile(ByVal phrase As String) As Func(Of HashSet(Of String), Boolean)
	Return ...
End Function

```

Thank you!

---

<div class="post-metadata">

**Author:** ![William\_Blech\_Sister](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/william_blech_sister/32/120552_2.png) [@William\_Blech\_Sister](https://forum.uipath.com/u/William_Blech_Sister)\
**Post date:** [June 10, 2020, 9:14pm UTC](https://forum.uipath.com/t/invoke-code-compile-functions/230189/2 "2020-06-10T21:14:00Z")

</div>

Hy @purplemouse651,

If you want you can create an excel file, create vba code there and then use the execute macro activity inside excel scope. Yes you can do it!  
I use it to run Sap gui scripting, for example, works great

---

<div class="post-metadata">

**Author:** ![purplemouse651](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@purplemouse651](https://forum.uipath.com/u/purplemouse651)\
**Post date:** [June 10, 2020, 9:21pm UTC](https://forum.uipath.com/t/invoke-code-compile-functions/230189/3 "2020-06-10T21:21:24Z")

</div>

Hi William,  
thank you for your answer. So far I do not want to create an Excel file. Also my Functions heavily use .net Framework functionalty. Lots of the stuff has no real corresponding in VBA.

Is there a possibility to define classes and functions in UIPath? The “invoke code” functionality seems not taking that kind of code-pattterns.

BR

---

<div class="post-metadata">

**Author:** ![nerlichman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nerlichman/32/523258_2.png) [@nerlichman](https://forum.uipath.com/u/nerlichman)\
**Post date:** [June 10, 2020, 9:21pm UTC](https://forum.uipath.com/t/invoke-code-compile-functions/230189/4 "2020-06-10T21:21:41Z")

</div>

Hi @purplemouse651, welcome to the forum!

It’s something like that!

However, if you want to execute a [VB.NET](http://VB.NET) script you can check this other activity and see if this works for you: [Invoke VBScript](https://docs.uipath.com/activities/docs/invoke-vbscript)

If you want more complex things, you could always [create your own custom activities](https://docs.uipath.com/activities/docs/creating-a-custom-activity).

---

<div class="post-metadata">

**Author:** ![William\_Blech\_Sister](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/william_blech_sister/32/120552_2.png) [@William\_Blech\_Sister](https://forum.uipath.com/u/William_Blech_Sister)\
**Post date:** [June 10, 2020, 9:49pm UTC](https://forum.uipath.com/t/invoke-code-compile-functions/230189/5 "2020-06-10T21:49:03Z")

</div>

Hy @purplemouse651,

Just to complement, you can create custom activities in C# using the Custom activity creator.

Have a look:  
[DEMO: Build custom activities in minutes with the UiPath Activity Creator - YouTube](https://youtu.be/p8GrdJHwHPw)
