This post is requested by Mayembe. He asked me to post a VBA code in Excel to access Hysys splitter.
Here is the VBA example
=================================================
' VBA code starts here
Option Explicit
Public hyApp As HYSYS.Application
Public simCase As SimulationCase
Public tee1 As TeeOp
Public Sub StartHYSYS()
Dim filename As String
Dim ratio As Variant
' LOADING HYSYS SIMULATION FILE
Set hyApp = CreateObject("HYSYS.Application")
hyApp.Visible = True
Set simCase = hyApp.ActiveDocument
If simCase Is Nothing Then
filename = Worksheets("Sheet1").Range("c4")
If filename <> "False" And simCase Is Nothing Then
Set simCase = GetObject(filename, "HYSYS.SimulationCase")
simCase.Visible = True
End If
End If
Set tee1 = simCase.Flowsheet.Operations("teeop").Item("tee-101")
ratio = tee1.SplitsValue
ratio(0) = Worksheets("Sheet1").Range("c5").Value
ratio(1) = Worksheets("Sheet1").Range("c6").Value
tee1.Splits.SetValues ratio, ""
End Sub
'this is the end of VBA code
=====================================
Just for your note, "TEEOP" is a operation code name for "TEE" or splitter in Hysys.
And here is the excel interface. I use previous example of hysys file to develop our model. If you forget about our previous hysys model, check previous example
Let me know that you have comment or request. We'll see what I can do. I hope.
Alex