Hi everyone!
I've been struggling to add components to Hysys (or UniSim) though VBA's code. I've tried a couple of different methods but none of them works.
Sub AddCompressorInHYSYS()
Dim hyApp As HYSYS.Application
Dim hyCase As HYSYS.SimulationCase
Set hyApp = CreateObject("HYSYS.Application")
Dim hyPath As String
hyPath = "C:\Users\ ....."
Set hyCase = GetObject(hyPath)
Dim Compressor As HYSYS.Operations
Set Compressor = hyCase.Flowsheet.ExtnPropertyPackage.AddComponent(Compressor)
or
Set Compressor = hyCase.Flowsheet.Operations.Item.Add("compressor")
and a variation of those.
I've read about ExtnPropertyPackage and AddComponent in Hysys Customization Guide but I still am not sure how to use it properly.
Thank you in advance!