Invoke VBA - Referencing other VB files within a VB file


I’ve developed a lot of macros for my company recently, while also working on implementing the macros into robots. The more macros I develop the harder it is to manage the code for all of them, so I was hoping it would be possible to make use of the “Invoke VBA” activity in order to split all the code into files I can source control, while also moving all responsibility of execution to the robot.

Now as VBA is not the same as VB, and although I save the macro files with the .vb extension, I’m unsure on how to go about, or if it is even possible to reference other .vb files from one. The main reason is that I have moved a lot of repetitive tasks into modules, that I can easily reference within my macros workbook. But if I move these macros to .vb files to invoke, is there a way for me to create these ‘utility’ methods in a file, and reference this file within the other macro files?

Thanks for your help,

hello i had same issue, what i have done is i have saved Macro code into just text file and reading that text and using alt+F11 write text in macro window(output of read text), then i was able to manage properly.


I guess this solution could work. I could export a sequence as a workflow that takes the file path of the code to be executed as a parameter, and in this sequence do all of the macros required to paste the code into excel and run it. That way I could just Invoke Workflow instead of invoke VBA.

I would still prefer a solution where I could just reference code from other files directly in the code though, as I prefer using as little UI automation as possible. I think your solution might be the best option if this is simply not possible with the Invoke VBA activity.

1 Like