0 votes
1 view
in RPA by (5.3k points)

So I'm not sure if this question requires knowledge on the UiPath software in order to be answered or not. I have been developing a lot of Excel macros for my company, and as I get more and more macros, it's harder to manage them.

We have been working on some robots as well within the company, and I notice that the robot has an activity where you can invoke VBA code within an Excel application scope. This activity reads a .vb file with code and invokes whatever method you specify within that file as a macro in the activated Excel application.

Ideally I would want to extract all my VBA code into separate files, and have the robots execute the macros through this activity. This would make it a lot easier to manage the code.

My question is then, if it is somehow possible for me to also extract the modules I've created that contain utility methods that I repeat throughout many macros into a .vb file, and reference this in the other macro files?

I don't know exactly how this activity invokes the code and what restrictions are placed on it. Within Excel, I can store re-usable methods in modules and call on them from other modules. This is what I want replicated on a file level. If there was some way of adding import statements to the top of the code to retrieve methods from other modules, so I could call them within the file.

My worries (and assumption) is that the activity simply reads it as a text file, and just imports it as a macro right into Excel. That if I wanted to reference any modules within my method, the modules would have to already exist in the Excel application.

I could always paste the utility methods into every .vb file, but that sort of defeats the purpose of making it easier to manage.

Is there anything I can do here?

Thanks,
TRS

1 Answer

0 votes
by (12.7k points)

You can definitely reference external assemblies (.dlls) in the UiPath. I did not do it with VB.Net Projects, but I did it with C# Projects which is in this case, the same thing.

To be able to generate the .dll, you will need to download Visual Studio Community Edition and follow a couple of tutorials on how to compile VB code.

All your VB code will be existing in this .dll. This would be your general repository or main library that you would access every time that you need it. As per my understanding, this is your main goal anyway right? "To access utility methods".

I don't know if, inside your macros, you can use specific Excel references that could lead to the compilation issues. So, be ready to reference everything that you will be needing inside the code.

In the end, to access your custom methods, you should need to reference the .dll and use the activity called: Invoke Method.

I hope this helps.

Interested in RPA ? Check out this RPA Certification by Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 10, 2019 in RPA by noah kapoor (5.3k points)
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !

Categories

...