I have created a flow as follows:

This flow basically opens SAP, opens an excel file and runs the VBA script in that excel file, and then closes the excel file.
When I run the script without Power Automate, the script runs perfectly without any errors. When I try to run the script through Power Automate, it always gives me an error "Subscript out of range".
I tried using the run macro in the Power Automate, but it gives the same result. I am not sure what exactly is the problem.
The error sub in VBA is this:
Sub Close_WBIOH()
Application.DisplayAlerts = False
Dim wbIOH As Workbook
Dim wsIOH As Worksheet
Dim rngcpy As Range
Set wbIOH = Workbooks("Inventory on Hand.xlsx")
Set wsIOH = wbIOH.Worksheets("Sheet1")
Set rngcpy = wsIOH.Range("A2", Range("A2").End(xlDown).End(xlToRight))
rngcpy.Copy
wbIOH.Close
Application.DisplayAlerts = True
End SubThe line on which the error occurs is:
Set wbIOH = Workbooks("Inventory on Hand.xlsx")Anyone knows why is this happening? Am I doing something wrong here?
Thank you.