cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Macros

RajathGopal
Level 5
Hello, I have an excel with 3 macros in it and the excel also has huge data. However when trying to open the excel it takes a lot of time.  I just wanted to check if it is feasible to integrate the macro's code in Bluprism by extending MS Excel VBO would this be a feasible solution.? Because removing the Macro Tab in excel decreases the time to open the workbook I was just wondering if this is implemented then if suppose the process fails in BP due to  some issue, this process cannot be completed manually because we do not have the macro tabs any more.  Any thoughts on how to go about this??   Thanks in Advance  
3 REPLIES 3

John__Carter
Staff
Staff
The Excel VBO uses the same API that macro code does, so yes, it should be possible to transplant the macro code into BP. However, macros are written in VBA and BP code stages use VB.Net. These are different languages with a similar syntax, so you can't paste macro code into BP and expect it to work, you'll need to reshape the code into VB.Net. And depending on the complexity of the macro, this could be time consuming. The BP code stage is not a development tool, and for anything but the most trivial code, it's usually easier to get the code working in something like Visual Studio first, and then paste it over to BP.

VijayDodamani
Level 5
Hello Rajath, I totally agree with john. Also it can possible that without writing a code stage, still you can achieve the output using macro only.  As per your problem statement,  it seems that you have created macro with extension XLSB. As XLSB macro code is available with each and every Excel instance that you open so it may take time to load the file, though XLSB is the faster than any other excel extension. The solution is like -  Create the xlsm file and copy paste the macro code. The macro's main function/sub modify in such a way that it will accept the input parameter as filename(Path of file) which will hold the values passed from BP. Inside the macro, open the file and continue with your macro operation and finally save the opened file. Here, with this approach, you need to write minimal code. You can duplicate ""Run Macro"" Action in MS EXCEL VBO and modify the newly created action, add start parameter to the action and add start parameter to the code stage.  Go to Code tab and modify the below line: Lets consider the start parameter would be ""FilePath"" then the code should be as below GetInstance(Handle).Run(Macro_Name,FilePath) That's it. Thank you. Regards, Vijay Rudrappa Dodamani

VijayDodamani
Level 5
Hello Rajath, I totally agree with john. Also it can possible that without writing a code stage, still you can achieve the output using macro only.  As per your problem statement,  it seems that you have created macro with extension XLSB. As XLSB macro code is available with each and every Excel instance that you open so it may take time to load the file, though XLSB is the faster than any other excel extension. The solution is like -  Create the xlsm file and copy paste the macro code. The macro's main function/sub modify in such a way that it will accept the input parameter as filename(Path of file) which will hold the values passed from BP. Inside the macro, open the file and continue with your macro operation and finally save the opened file. Here, with this approach, you need to write minimal code. You can duplicate ""Run Macro"" Action in MS EXCEL VBO and modify the newly created action, add start parameter to the action and add start parameter to the code stage.  Go to Code tab and modify the below line: Lets consider the start parameter would be ""FilePath"" then the code should be as below GetInstance(Handle).Run(Macro_Name,FilePath) That's it. Thank you. Regards, Vijay Rudrappa Dodamani