Hi,
I am trying to write an Excel VBA which automates interaction between Excel and HYSYS. I want to be able to specify inlet temperatures and flows of an exchanger and UA of the exchanger from Excel, then retrieve the outlet temperatures calculated by HYSYS. Heat exchanger model I am using is Exchanger Design (End Point)
So far I have been able to write temperatures and flows into streams, and retrieve UA and Duty from the exchanger however I cannot specify UA for the exchanger from Excel VBA. When I try to do so I get "permission denied" error.
Below is the script I am trying to use:
' exchanger in HYSYS is called "HX1" and all variables have been declared Variant
' simCase (i.e. simulation case) has been defined previously
Set HX1 = simCase.Flowsheet.Operations.Item("HX1")
HX1.UA.SetValue 65000, "W/C"
The specific error I get is "Run-time error '70': Permission denied.
Is there another way apart from trying to set a value to do this? Any help greatly appreciated.