Invoke Power Shell: Object reference not set to an instance of an object

Hello,
I am using Invoke Power Shell Activity. I am passing a script using string variable. What does the script do is it initializes the excel and executes a macro and passes variables that contains dynamically value to the macro. The macro file which I am executing through Power Shell is of extension BAS file. So, the issue I am facing is that my script is working perfectly fine, and the macro is also getting executed successfully. But when it comes back to UiPath after executing the script I am getting error Invoke Power Shell: Object reference not set to an instance of an object. I have checked all the variables and arguments which I am passing to the script they all are assigned properly and have tried different debugging methods too. Despite that why I am getting this error??

UiPath->PowerShell->BAS

What is UiPath expecting from PowerShell after the activity is finalised?
And what is PowerShell returning?

UiPath is not expecting anything and also Power Shell is not returning anything. The invoke power shell script task is to execute the macro stored in bas file and pass variables dynamically to that macro. I am attaching the workflow.
Book1.xlsx (9.8 KB)
Main.xaml (9.2 KB)
Main.xaml.json (141 Bytes)
PowershellScript.txt (517 Bytes)
project.json (1.7 KB)