Use of ESStableD.ocx in Microsoft(R) Excel(R)

How to use of ESStableD.ocx in Microsoft(R) Excel(R) is presented in this page.

The example Excel(R) file of the following explanation can be run only after ESSTableD..ocx has been installed.  Therefore, it is required to install ESStableD.ocx before the run of example Excel(R) file.    When you open the example file, you should select "Open(including Macro)" in Excel(R) opening session.

There may be various ways to use ESSTableD.ocx in Excel(R).    Herein two ways are presented we have found.

One way is to use ESStableD.ocx as one of controls in Excel(R) sheet, and the other way is to use programmatically in Macro(Visual Basic) function of Excel(R).

We apologize that some pictures below are with Korean language because we do not have English version of Excel(R).  Additionally the menu name we referred below may not be correct ones because we interpreted arbitrarily into English based on Korean menu name of Excel(R) we are using.    However, we presume that you may know what is the picture and what is the menu.

1. One of Controls in Excel(R) Sheet

ÄÁÆ®·Ñ ¹Ú½º 

 1) Select [Control Tool Box] in [View]-[Tool Collection]

 2) Click [Other Controls] at the bottom of [Control Tool Box] and then select the control of "pjt_ESStableD.ESStableD" which has been registered by installing ESSTableD.ocx we provided.

 3) When moved into Excel(R) sheet, the mouse icon is changed into cross.    Then drag the mouse and create a instance of ESStableD.ocx on the Excel(R) sheet.

 4) Once the instance is created, the mode of Excel(R) is changed into Design Mode and the left top button(Design Mode Toggle Button) of [Control Tool Box] is set as pressed.

5) Click the Design Mode Toggle Button to finish design mode.  Then ESStableD.ocx instance works providing with steam table data in User Interface Mode.

The following picture shows the ESStableD.ocx made in such a way.  The steam table works as it is without using macro function of Excel(R).    Now you may use steam table in any sheet where you want to locate.

 

 

2. Programmatic Use in Macro(Visual Basic)

1) Create a program in Excel(R) sheet using controls like [Command Button], [Combo Box] of [Control Tool Box].  In the example, "Steam Table" and "Steam Turbine Efficiency" calculation have been created.

< Steam Table Example >

The first "Example of User Mode" shows the User Interface Plate of ESStableD.ocx, and then the steam/water properties and units the user gets in the User Interface Plate shall be pun into the relevant cells.

The second "Example of STABLE Method(Steam/Water)" puts into the relevant cells the specific volume, enthalpy, entropy values getting by the pressure and temperature values in yellow colored cells using STABLE method of ESSTableD.ocx.  The unit of each property can be selected by the user  in the combo box provided..

The third "Example of SSTABLE Method(Sat. Steam/Water)" puts into the relevant cells the specific volume, enthalpy, entropy values of gas and liquid status getting by the pressure or temperature values in yellow colored cells using SSTABLE method of ESSTableD.ocx.   The search basis between pressure and temperature can be selected by the user and the unit of each property can also be selected by the user  in the combo box provided..

 

 < Steam Turbine Efficiency Example >

The first "Steam Turbine Efficiency Calculation" example calculates AEEP(Available Energy End Point) and steam turbine efficiency by inlet steam condition, exhaust steam pressure and enthalpy input by the user.  The inlet steam condition puts into the relevant cells by User Interface Plate of ESStableD.ocx that pops up by clicking [Steam Table(Inlet Stem)] command button.   The unit of each property can be selected by the user in the combo box provided.

 

The second "Steam Turbine Exhaust Condition Calculation" example calculates AEEP and turbine exhaust steam conditions by inlet steam condition and turbine efficiency input by the user.  The inlet steam condition puts into the relevant cells by User Interface Plate of ESStableD.ocx that pops up by clicking [Steam Table(Inlet Stem)] command button.   The unit of each property can be selected by the user in the combo box provided.

2) Transfer to Design Mode by clicking [Design Mode] button located at left top of [Control Tool Box].

3) Open [Microsoft(R) Visual Basic - Design] window by clicking [Code View] button located the second row from left top of [Control Tool Box].

< Microsoft(R) Visual Basic - Design Window >

 

4) Open [Tool Box] by clicking menu [View]-[Tool Box].

 

 

 

 

5) Open [Additional Control] window by clicking menu [Tool]-[Additional Control..] and select "pjt_ESStableD.ESStableD" in the list.   Then click [OK] command button.

 

Note) The icon of ESStableD.ocx has been added to [Tool Box].   Now ESSTableD.ocx can be used as one of controls in Excel(R) macro function.

 

 

 

 6) Add one UserForm by clicking Menu [Insert]-[User Defined Form] and change the [Name] property of the UserForm to [frmStable].

7) Create ESStableD1 instance of ESStableD.ocx on frmStable by clicking ESStableD.ocx in [Tool Box] and dragging mouse on frmStable.

 

< Now let's start coding. >

8) Write code as below in "Workbook_Open( )" Sub Procedure so that the units of ESStableD.ocx can be listed in the unit combo box of the Excel(R) sheets when the user open the Workbook(Excel(R) file).

In the code below "Sheet_ESStableD" is the name property of "Steam Table" Excel(R) sheet and "Sheet2" is the name property of "STEff" Excel(R) sheet.    The name "Sheet_ESStableD" is the name input by ENGSoft Inc in the property window of the sheet, whereas the name "Sheet2" is default name of the sheet.

 

Private Sub Workbook_Open()

 

Dim intX As Long

    

    'set the combobox style at "List" type so that the user can not edit the combo box list.

    Sheet_ESStableD.cmbuPRSteam.Style = fmStyleDropDownList

    Sheet_ESStableD.cmbuTPSteam.Style = fmStyleDropDownList

    Sheet_ESStableD.cmbuSVOLSteam.Style = fmStyleDropDownList

    Sheet_ESStableD.cmbuENTHSteam.Style = fmStyleDropDownList

    Sheet_ESStableD.cmbuENTROSteam.Style = fmStyleDropDownList

    

    Sheet_ESStableD.cmbuPRSat.Style = fmStyleDropDownList

    Sheet_ESStableD.cmbuTPSat.Style = fmStyleDropDownList

    Sheet_ESStableD.cmbuSVOLSat.Style = fmStyleDropDownList

    Sheet_ESStableD.cmbuENTHSat.Style = fmStyleDropDownList

    Sheet_ESStableD.cmbuENTROSat.Style = fmStyleDropDownList

    

    Sheet_ESStableD.cmbSatSel.Style = fmStyleDropDownList

    

    Sheet2.cmbuENTHEffEX.Style = fmStyleDropDownList

    Sheet2.cmbuENTHEffEXae.Style = fmStyleDropDownList

    Sheet2.cmbuENTHEffIN.Style = fmStyleDropDownList

    Sheet2.cmbuENTHExhEX.Style = fmStyleDropDownList

    Sheet2.cmbuENTHExhEXae.Style = fmStyleDropDownList

    Sheet2.cmbuENTHExhIN.Style = fmStyleDropDownList

    Sheet2.cmbuENTROEffIN.Style = fmStyleDropDownList

    Sheet2.cmbuENTROExhEX.Style = fmStyleDropDownList

    Sheet2.cmbuENTROExhIN.Style = fmStyleDropDownList

    Sheet2.cmbuPREffEX.Style = fmStyleDropDownList

    Sheet2.cmbuPREffIN.Style = fmStyleDropDownList

    Sheet2.cmbuPRExhEX.Style = fmStyleDropDownList

    Sheet2.cmbuPRExhIN.Style = fmStyleDropDownList

    Sheet2.cmbuSVOLExhEX.Style = fmStyleDropDownList

    Sheet2.cmbuTPEffIN.Style = fmStyleDropDownList

    Sheet2.cmbuTPExhEX.Style = fmStyleDropDownList

    Sheet2.cmbuTPExhIN.Style = fmStyleDropDownList

    

    'Add the unit strings of ESStableD.ocx into the unit combo boxes.

    For intX = 0 To 15 'The quantity of pressure unit strings is 15.

        frmStable.ESStableD1.uPR = intX 'Set the unit index of ESSTableD1.

        Sheet_ESStableD.cmbuPRSteam.AddItem frmStable.ESStableD1.sPR, intX 'Add the unit string of ESSTableD1 to the pressure combo box "cmbuPRSteam".

        Sheet_ESStableD.cmbuPRSat.AddItem frmStable.ESStableD1.sPR, intX

        

        Sheet2.cmbuPREffEX.AddItem frmStable.ESStableD1.sPR, intX

        Sheet2.cmbuPREffIN.AddItem frmStable.ESStableD1.sPR, intX

        Sheet2.cmbuPRExhEX.AddItem frmStable.ESStableD1.sPR, intX

        Sheet2.cmbuPRExhIN.AddItem frmStable.ESStableD1.sPR, intX

                

    Next intX

 

    For intX = 0 To 3 'Temperature

        frmStable.ESStableD1.uTP = intX

        Sheet_ESStableD.cmbuTPSteam.AddItem frmStable.ESStableD1.sTP, intX

        Sheet_ESStableD.cmbuTPSat.AddItem frmStable.ESStableD1.sTP, intX

        

        Sheet2.cmbuTPEffIN.AddItem frmStable.ESStableD1.sTP, intX

        Sheet2.cmbuTPExhEX.AddItem frmStable.ESStableD1.sTP, intX

        Sheet2.cmbuTPExhIN.AddItem frmStable.ESStableD1.sTP, intX

        

    Next intX

 

    For intX = 0 To 5 'Specific volume

        frmStable.ESStableD1.uSVOL = intX

        Sheet_ESStableD.cmbuSVOLSteam.AddItem frmStable.ESStableD1.sSVOL, intX

        Sheet_ESStableD.cmbuSVOLSat.AddItem frmStable.ESStableD1.sSVOL, intX

        

        Sheet2.cmbuSVOLExhEX.AddItem frmStable.ESStableD1.sSVOL, intX

        

    Next intX

 

    For intX = 0 To 4 'Enthalpy

        frmStable.ESStableD1.uENTH = intX

        Sheet_ESStableD.cmbuENTHSteam.AddItem frmStable.ESStableD1.sENTH, intX

        Sheet_ESStableD.cmbuENTHSat.AddItem frmStable.ESStableD1.sENTH, intX

        

        Sheet2.cmbuENTHEffEX.AddItem frmStable.ESStableD1.sENTH, intX

        Sheet2.cmbuENTHEffEXae.AddItem frmStable.ESStableD1.sENTH, intX

        Sheet2.cmbuENTHEffIN.AddItem frmStable.ESStableD1.sENTH, intX

        Sheet2.cmbuENTHExhEX.AddItem frmStable.ESStableD1.sENTH, intX

        Sheet2.cmbuENTHExhEXae.AddItem frmStable.ESStableD1.sENTH, intX

        Sheet2.cmbuENTHExhIN.AddItem frmStable.ESStableD1.sENTH, intX

        

    Next intX

 

    For intX = 0 To 4 'Entropy

        frmStable.ESStableD1.uENTRO = intX

        Sheet_ESStableD.cmbuENTROSteam.AddItem frmStable.ESStableD1.sENTRO, intX

        Sheet_ESStableD.cmbuENTROSat.AddItem frmStable.ESStableD1.sENTRO, intX

        

        Sheet2.cmbuENTROEffIN.AddItem frmStable.ESStableD1.sENTRO, intX

        Sheet2.cmbuENTROExhEX.AddItem frmStable.ESStableD1.sENTRO, intX

        Sheet2.cmbuENTROExhIN.AddItem frmStable.ESStableD1.sENTRO, intX

        

    Next intX

 

    'Search basis

    Sheet_ESStableD.cmbSatSel.AddItem "Pressure", 0

    Sheet_ESStableD.cmbSatSel.AddItem "Temperature", 1

 

 

    'Select the first unit of each combo box.

    Sheet_ESStableD.cmbuPRSteam.ListIndex = 0

    Sheet_ESStableD.cmbuTPSteam.ListIndex = 0

    Sheet_ESStableD.cmbuSVOLSteam.ListIndex = 0

    Sheet_ESStableD.cmbuENTHSteam.ListIndex = 0

    Sheet_ESStableD.cmbuENTROSteam.ListIndex = 0

    

    Sheet_ESStableD.cmbuPRSat.ListIndex = 0

    Sheet_ESStableD.cmbuTPSat.ListIndex = 0

    Sheet_ESStableD.cmbuSVOLSat.ListIndex = 0

    Sheet_ESStableD.cmbuENTHSat.ListIndex = 0

    Sheet_ESStableD.cmbuENTROSat.ListIndex = 0

    

    Sheet_ESStableD.cmbSatSel.ListIndex = 0

    

    Sheet2.cmbuENTHEffEX.ListIndex = 0

    Sheet2.cmbuENTHEffEXae.ListIndex = 0

    Sheet2.cmbuENTHEffIN.ListIndex = 0

    Sheet2.cmbuENTHExhEX.ListIndex = 0

    Sheet2.cmbuENTHExhEXae.ListIndex = 0

    Sheet2.cmbuENTHExhIN.ListIndex = 0

    Sheet2.cmbuENTROEffIN.ListIndex = 0

    Sheet2.cmbuENTROExhEX.ListIndex = 0

    Sheet2.cmbuENTROExhIN.ListIndex = 0

    Sheet2.cmbuPREffEX.ListIndex = 0

    Sheet2.cmbuPREffIN.ListIndex = 0

    Sheet2.cmbuPRExhEX.ListIndex = 0

    Sheet2.cmbuPRExhIN.ListIndex = 0

    Sheet2.cmbuSVOLExhEX.ListIndex = 0

    Sheet2.cmbuTPEffIN.ListIndex = 0

    Sheet2.cmbuTPExhEX.ListIndex = 0

    Sheet2.cmbuTPExhIN.ListIndex = 0

 

    'Set language of ESStableD1.

    frmStable.ESStableD1.ES_Language = ES_English

 

End Sub

 

9) Write the code of sheet [Steam Table](name property : "Sheet_ESStableD") as below.

Private Sub cmdStable_Click() 'When clicking the command button [Steam Table] (property name : "cmdStable"),

 

    frmStable.StableCallSource = 0 'set the public variable "StableCallSource" of "frmStable" as 0 in order to make "frmStable" identify who calls,

    

    frmStable.ESStableD1.Enabled_Unit = True 'set "Enabled_Unit" property of ESStableD1 as true so that the user can select the units of steam and water condition in User Interface Plate, and

 

    frmStable.Show  'show "frmStable" to the user.

    

End Sub

 

 

Private Sub cmdStableSat_Click() 'When clicking the command button [SSTABLE Method (Sat. Steam/Water)],

 

Dim sngX As Single

 

    'set the unit index properties of ESStableD1 as the unit indexes the user selected in the unit combo boxes,

    frmStable.ESStableD1.uPR = cmbuPRSat.ListIndex

    frmStable.ESStableD1.uTP = cmbuTPSat.ListIndex

    frmStable.ESStableD1.uSVOL = cmbuSVOLSat.ListIndex

    frmStable.ESStableD1.uENTH = cmbuENTHSat.ListIndex

    frmStable.ESStableD1.uENTRO = cmbuENTROSat.ListIndex

    

    Select Case cmbSatSel.ListIndex 'If the index the user selected in [Search Basis] combo box is

    Case 0 'pressure, then

        sngX = Sheet_ESStableD.Cells(28, 3).Value 'get the value of pressure cell,

        frmStable.ESStableD1.SSTABLE SStable_PR, sngX 'call SSTABLE method with the pressure value,

        Sheet_ESStableD.Cells(29, 3).Value = frmStable.ESStableD1.TSAT 'input the sat. temperature gotten into the relevant cell.

    Case 1 'temperature, then

        sngX = Sheet_ESStableD.Cells(29, 3).Value 'get the value of temperature cell,

        frmStable.ESStableD1.SSTABLE SStable_TP, sngX 'call SSTABLE method with the temperature value,

        Sheet_ESStableD.Cells(28, 3).Value = frmStable.ESStableD1.PSAT 'input the sat. pressure gotten into the relevant cell.

    End Select

        

    'input the remaining sat. steam and water conditions into the relevant cells.

    Sheet_ESStableD.Cells(30, 3).Value = frmStable.ESStableD1.SVOLG

    Sheet_ESStableD.Cells(30, 4).Value = frmStable.ESStableD1.SVOLF

    

    Sheet_ESStableD.Cells(31, 3).Value = frmStable.ESStableD1.ENTHG

    Sheet_ESStableD.Cells(31, 4).Value = frmStable.ESStableD1.ENTHF

 

    Sheet_ESStableD.Cells(32, 3).Value = frmStable.ESStableD1.ENTROG

    Sheet_ESStableD.Cells(32, 4).Value = frmStable.ESStableD1.ENTROF

 

End Sub

 

Private Sub cmdStableSteam_Click() 'When clicking the command button [STABLE Method (Steam/Water)],

 

Dim PR As Single, TP As Single

 

     'set the unit index properties of ESStableD1 as the unit indexes the user selected in the unit combo boxes,

    frmStable.ESStableD1.uPR = cmbuPRSteam.ListIndex

    frmStable.ESStableD1.uTP = cmbuTPSteam.ListIndex

    frmStable.ESStableD1.uSVOL = cmbuSVOLSteam.ListIndex

    frmStable.ESStableD1.uENTH = cmbuENTHSteam.ListIndex

    frmStable.ESStableD1.uENTRO = cmbuENTROSteam.ListIndex

    

    PR = Sheet_ESStableD.Cells(16, 3).Value 'get the value of pressure cell,

    TP = Sheet_ESStableD.Cells(17, 3).Value 'get the value of temperature cell, and

    

    frmStable.ESStableD1.STABLE Stable_PR, PR, Stable_TP, TP 'call STABLE method with the pressure and temperature values.

    

    'input the remaining steam or water conditions into the relevant cells.

    Sheet_ESStableD.Cells(18, 3).Value = frmStable.ESStableD1.SVOL

    Sheet_ESStableD.Cells(19, 3).Value = frmStable.ESStableD1.ENTH

    Sheet_ESStableD.Cells(20, 3).Value = frmStable.ESStableD1.ENTRO

    

    

End Sub

 

 

10) Write the code of sheet [STEff](name property : "Sheet2") as below.

Private Sub cmdEffCalc_Click() 'When clicking the command button [Efficiency Calc] (property name : "cmdEffCalc"),

 

Dim InENTH As Single, InENTRO As Single, ExhPR As Single, ExhENTH As Single

Dim AEEP As Single, EFF As Single

 

    'check the input values.

    InENTH = CSng(Val(Sheet2.Cells(6, 3).Value))

    

    If InENTH <= 0 Then 'If inlet enthalpy is equal to or less than 0, quit calculation.

        MsgBox "Inlet enthalpy value should be larger than zero." & vbLf & _

        "Enter inlet enthalpy using Steam Table command button.", vbCritical

        Exit Sub

    End If

    

    InENTRO = CSng(Val(Sheet2.Cells(7, 3).Value))

    

    If InENTRO <= 0 Then 'If inlet entropy is equal to or less than 0, quit calculation.

        MsgBox "Inlet entropy value should be larger than zero." & vbLf & _

        "Enter inlet entropy using Steam Table command button.", vbCritical

        Exit Sub

    End If

 

    ExhPR = CSng(Val(Sheet2.Cells(10, 3).Value))

    

    If ExhPR <= 0 Then 'If exhaust pressure is equal to or less than 0, quit calculation.

        MsgBox "Exhaust pressure value should be larger than zero." & vbLf & _

        "Enter exhaust pressure.", vbCritical

        Exit Sub

    End If

 

    ExhENTH = CSng(Val(Sheet2.Cells(11, 3).Value))

    

    If ExhENTH <= 0 Then 'If exhaust enthalpy is equal to or less than 0, quit calculation.

        MsgBox "Exhaust enthalpy value should be larger than zero." & vbLf & _

        "Enter exhaust enthalpy.", vbCritical

        Exit Sub

    End If

    

    'AEEP

    frmStable.ESStableD1.STABLE Stable_PR, ExhPR, Stable_ENTRO, InENTRO 'call STABLE method with inlet entropy and exhaust pressure.

    AEEP = frmStable.ESStableD1.ENTH 'set the enthalpy gotten as AEEP.

    

    'efficiency

    EFF = (InENTH - ExhENTH) / (InENTH - AEEP) * 100 'calculate percent efficiency

    

    'output

    Sheet2.Cells(13, 3).Value = AEEP 'input the values into the relevant cells.

    Sheet2.Cells(14, 3).Value = EFF

    

 

End Sub

 

Private Sub cmdExhCalc_Click() 'When clicking the command button [Exhaust Calc] (property name : "cmdExhCalc"),

 

Dim InENTH As Single, InENTRO As Single, ExhPR As Single, ExhENTH As Single

Dim AEEP As Single, EFF As Single

 

    'check the input values.

    InENTH = CSng(Val(Sheet2.Cells(26, 3).Value))

    

    If InENTH <= 0 Then 'If inlet enthalpy is equal to or less than 0, quit calculation.

        MsgBox "Inlet enthalpy value should be larger than zero." & vbLf & _

        "Enter inlet enthalpy using Steam Table command button.", vbCritical

        Exit Sub

    End If

    

    InENTRO = CSng(Val(Sheet2.Cells(27, 3).Value))

    

    If InENTRO <= 0 Then 'If inlet entropy is equal to or less than 0, quit calculation.

        MsgBox "Inlet entropy value should be larger than zero." & vbLf & _

        "Enter inlet entropy using Steam Table command button.", vbCritical

        Exit Sub

    End If

 

    ExhPR = CSng(Val(Sheet2.Cells(30, 3).Value))

    

    If ExhPR <= 0 Then 'If exhaust pressure is equal to or less than 0, quit calculation.

        MsgBox "Exhaust pressure value should be larger than zero." & vbLf & _

        "Enter exhaust pressure.", vbCritical

        Exit Sub

    End If

 

    EFF = CSng(Val(Sheet2.Cells(32, 3).Value))

    

    If EFF <= 0 Then 'If efficiency is equal to or less than 0, quit calculation.

        MsgBox "Efficiency value should be larger than zero." & vbLf & _

        "Enter efficiency.", vbCritical

        Exit Sub

    End If

    

    'AEEP

    frmStable.ESStableD1.STABLE Stable_PR, ExhPR, Stable_ENTRO, InENTRO 'call STABLE method with inlet entropy and exhaust pressure.

    AEEP = frmStable.ESStableD1.ENTH 'set the enthalpy gotten as AEEP.

 

    'exhaust enthalpy

    ExhENTH = InENTH - (InENTH - AEEP) * EFF / 100 'calculate exhaust enthalpy.

    

    'exhaust condition

    frmStable.ESStableD1.STABLE Stable_PR, ExhPR, Stable_ENTH, ExhENTH 'get other exhaust conditions using STABLE method with exhaust pressure and enthalpy.

 

    'input the values into the relevant cells.

    Sheet2.Cells(33, 3).Value = AEEP

    

    Sheet2.Cells(36, 3).Value = frmStable.ESStableD1.TP

    

    If frmStable.ESStableD1.Quality < 0 Then 'If the quality gotten is less than 0,

        Sheet2.Cells(37, 3).Value = "Water" 'input "Water",

    ElseIf frmStable.ESStableD1.Quality > 1 Then 'If it is larger than 1,

        Sheet2.Cells(37, 3).Value = "Steam" 'input "Steam".

    Else 'if in between 0 and 1,

        Sheet2.Cells(37, 3).Value = frmStable.ESStableD1.Quality 'input the quality value as it is.

    End If

    

    Sheet2.Cells(38, 3).Value = frmStable.ESStableD1.ENTH

    Sheet2.Cells(39, 3).Value = frmStable.ESStableD1.ENTRO

    Sheet2.Cells(40, 3).Value = frmStable.ESStableD1.SVOL

    

 

End Sub

 

 

Private Sub cmdStableEff_Click() 'When clicking [Steam Table(Inlet Steam)] of [Efficiency Calc](property name : "cmdStableEff")

 

    'setting who calls.

    frmStable.StableCallSource = 1 'set the public variable "StableCallSource" of "frmStable" as 1 in order to make "frmStable" identify who calls,

    

    'set the unit index properties of ESStableD1 as the unit indexes the user selected in the unit combo boxes,

    frmStable.ESStableD1.uPR = cmbuPREffIN.ListIndex

    frmStable.ESStableD1.uTP = cmbuTPEffIN.ListIndex

    frmStable.ESStableD1.uENTH = cmbuENTHEffIN.ListIndex

    frmStable.ESStableD1.uENTRO = cmbuENTROEffIN.ListIndex

 

    'setting unit_enabled as false

    frmStable.ESStableD1.Enabled_Unit = False 'set Enabled_Unit" property of ESStableD1 as false so that the user can not select the units of steam and water condition in User Interface Plate, and

    

    'Form calling

    frmStable.Show 'show "frmStable" to the user.

 

End Sub

 

Private Sub cmdStableExh_Click() 'When clicking [Steam Table(Inlet Steam)] of [Exhaust Calc](property name : "cmdStableExh")

 

    frmStable.StableCallSource = 2 'set the public variable "StableCallSource" of "frmStable" as 2 in order to make "frmStable" identify who calls,

    

    'set the unit index properties of ESStableD1 as the unit indexes the user selected in the unit combo boxes,

    frmStable.ESStableD1.uPR = cmbuPRExhIN.ListIndex

    frmStable.ESStableD1.uTP = cmbuTPExhIN.ListIndex

    frmStable.ESStableD1.uENTH = cmbuENTHExhIN.ListIndex

    frmStable.ESStableD1.uENTRO = cmbuENTROExhIN.ListIndex

 

    frmStable.ESStableD1.Enabled_Unit = False 'set Enabled_Unit" property of ESStableD1 as false so that the user can not select the units of steam and water condition in User Interface Plate, and

    

    frmStable.Show 'show "frmStable" to the user.

 

End Sub

 

11) Write the code of UserForm "frmStable" as below.

'The "frmStable" is the userform that has the instance "ESStableD1" of ESStableD.ocx.

Public StableCallSource As Integer 'Declare a public variable of "StableCallSource" as a identifier of calling source.

'StableCallSource :

'0 = cmdStable of Sheet_ESStableD

'1 = cmdStableEff of Sheet2

'2 = cmdStableExh of Sheet2

 

Private Sub ESStableD1_CancelClick() 'When clicking [Cancel] command button of ESStableD1,

 

    Unload Me 'remove the userform from memory(Unload).

    

End Sub

 

Private Sub ESStableD1_OKClick() 'When clicking [OK] command button of ESStableD1,

 

Select Case StableCallSource 'If the "frmStable" is called from,

Case 0 '"cmdStable" of Sheet_ESStableD, then

 

    'input the unit string of ESStableD1 into the relevant cells,

    Sheet_ESStableD.Cells(4, 2).Value = frmStable.ESStableD1.sPR

    Sheet_ESStableD.Cells(5, 2).Value = frmStable.ESStableD1.sTP

    Sheet_ESStableD.Cells(6, 2).Value = frmStable.ESStableD1.sSVOL

    Sheet_ESStableD.Cells(7, 2).Value = frmStable.ESStableD1.sENTH

    Sheet_ESStableD.Cells(8, 2).Value = frmStable.ESStableD1.sENTRO

    Sheet_ESStableD.Cells(9, 2).Value = frmStable.ESStableD1.sVisco

    Sheet_ESStableD.Cells(10, 2).Value = frmStable.ESStableD1.sViscoX

    

    'input the steam/water condition values into the relevant cells, and

    Sheet_ESStableD.Cells(4, 3).Value = frmStable.ESStableD1.PR

    Sheet_ESStableD.Cells(5, 3).Value = frmStable.ESStableD1.TP

    Sheet_ESStableD.Cells(6, 3).Value = frmStable.ESStableD1.SVOL

    Sheet_ESStableD.Cells(7, 3).Value = frmStable.ESStableD1.ENTH

    Sheet_ESStableD.Cells(8, 3).Value = frmStable.ESStableD1.ENTRO

    Sheet_ESStableD.Cells(9, 3).Value = frmStable.ESStableD1.Visco

    Sheet_ESStableD.Cells(10, 3).Value = frmStable.ESStableD1.ViscoX

 

    Unload Me 'remove the userform from memory(Unload).

    

Case 1 'cmdStableEff of Sheet2, then

 

    If frmStable.ESStableD1.Quality <= 0 Then 'if the quality is equal to or less than 0,

        MsgBox "Inlet is water." & vbLf & "Input again.", vbCritical 'show warning message,

    Else 'if not,

        'input the values of ESStableD1 into the relevant cells.

        Sheet2.Cells(4, 3).Value = frmStable.ESStableD1.PR

        Sheet2.Cells(5, 3).Value = frmStable.ESStableD1.TP

        Sheet2.Cells(6, 3).Value = frmStable.ESStableD1.ENTH

        Sheet2.Cells(7, 3).Value = frmStable.ESStableD1.ENTRO

    

        Unload Me 'remove the userform from memory(Unload).

    End If

 

Case 2 'cmdStableExh of Sheet2, then

 

    If frmStable.ESStableD1.Quality <= 0 Then 'if the quality is equal to or less than 0,

        MsgBox "Inlet is water." & vbLf & "Input again.", vbCritical 'show warning message,

    Else 'if not,

        'input the values of ESStableD1 into the relevant cells.

        Sheet2.Cells(24, 3).Value = frmStable.ESStableD1.PR

        Sheet2.Cells(25, 3).Value = frmStable.ESStableD1.TP

        Sheet2.Cells(26, 3).Value = frmStable.ESStableD1.ENTH

        Sheet2.Cells(27, 3).Value = frmStable.ESStableD1.ENTRO

 

        Unload Me 'remove the userform from memory(Unload).

    End If

 

End Select

    

End Sub

 

This is the example of using the ActiveX(R) control "ESStableD.ocx" in Microsoft(R) Excel(R).

Excel(R) is one of the most popular software that engineers use in their engineering calculation.    However, Excel(R) has some limitations.   One of them is the difficulty in programming.   Steam table is the one that engineers come up with in Excel(R) calculation.

Now you do not have to worry about steam table application in Excel(R) calculation when you use ESStableD.ocx.

Try to use ESSTableD.ocx.

Hope you enjoy programming.


Copyright (c) 2000 - 2003 ENGSoft Inc., Seoul, Korea, All right reserved.