Passing Parameters to Macro from Blueprism

Hi Team,

I have a macro with me for saving the "Chart" in excel as image. But I want to pass the image name and the path as parameters to the Macro using Blueprism.

Can someone please help me on this?

Sub SaveSelectedChartImage()
ActiveChart.Export "C:\Users\ABC\Desktop\Test\test.png"
End Sub
 

sahil_raina_91

Active Member
Hi Team,

I have a macro with me for saving the "Chart" in excel as image. But I want to pass the image name and the path as parameters to the Macro using Blueprism.

Can someone please help me on this?

Sub SaveSelectedChartImage()
ActiveChart.Export "C:\Users\ABC\Desktop\Test\test.png"
End Sub

If you can edit the macro, the easier way would be :

1. Write the Path in a cell
Using write cell value, update the path C:\Users\ABC\Desktop\Test\test.png in A1 cell
2. Update the macro to pick the path from that cell
Sub SaveSelectedChartImage()
ActiveChart.Export ActiveSheet.Range("A1")
End Sub
 

sahil_raina_91

Active Member
I want to pass the parameter from Blueprism directly to the macro which I am going to run.

For that you will need to duplicate the "Run Macro" action.
Edit the code to : GetInstance(Handle).Run(Macro_Name,param1,param2,param3)

Here param1,param2,param3 etc should be your inputs to code stage
 
@sahil_raina_91
1st suggestion worked for me and getting the expected result. Thanks.

For the 2nd suggestion, How to receive the parameter that we are passing from Blueprism?

For Example:

For the below macro function I want to store the value that I am passing from Blueprism in variable "Message".

Sub Macro3()
'
' Macro3 Macro
'

'
Dim Message As Variant

End Sub
 

sahil_raina_91

Active Member
@sahil_raina_91
1st suggestion worked for me and getting the expected result. Thanks.

For the 2nd suggestion, How to receive the parameter that we are passing from Blueprism?

For Example:

For the below macro function I want to store the value that I am passing from Blueprism in variable "Message".

Sub Macro3()
'
' Macro3 Macro
'

'
Dim Message As Variant

End Sub

Hopefully, this should solve your doubts

In code stage :
GetInstance(Handle).Run(Macro_Name,"Test",100) (Hard-coding just for explanation, keep these dynamic)
In Macro:
Sub Macro3(Message As Variant, Count As Integer)
MsgBox (Message & Count)
Message = "Updated"
MsgBox (Message & Count)
End Sub
 
Top