Here is the sample:
Private Sub Display_DataUpdate() Dim d As Variant Dim s As Variant v = Value1.GetValue(d, s) If v > 200 Then Text1.Contents = "CDT158 High" ElseIf v < 100 Then Text1.Contents = "CDT158 Lo" Else Text1.Contents = "" End If End Sub
Value1 is the value symbol referencing the PI Point cdt158.
Text1 is a text symbol.
I am pleasure to obtain information again
Is there another way without value symbol referencing tag ?
Because I use a lot of tags and image in a display, all the value symbol gets a large share of display
And don't want to show value in real time. Only want to display message "High" or "Lo" with text for all the PI tags
I wish use PI tag name directly in the script instead of Value1 object.
Is it possible?
That is definitely possible using PI SDK in Processbook VBA. Here is the sample code.
Private Sub Display_DataUpdate() Dim pt As PIPoint Set pt = Servers.DefaultServer.PIPoints("cdt158") v = pt.Data.Snapshot.Value If v > 200 Then Text1.Contents = "CDT158 High" ElseIf v < 100 Then Text1.Contents = "CDT158 Lo" Else Text1.Contents = " " End If End Sub
Oh Good~ That's exacty what I want !!
You are Korean, I presume? I'm Korean ㅎㅎ
Please one more suggestion for another query
Possible to disable Build mode? Or disable modify my display? I want to prevent my workbook from anybody's computer
As a result of searching that problem I found your simiral solution
It's impossible editing regedit others desktop
So I should use ReadOnly code, seems it's not
I have a dash at prevent that all user know property of objects and change objects(color, font, size, etc)
It's correct disable "Build mode"
In other ways, let All menu bar and toolbar are hidden.
It's possible with VBA?
안녕하세요 윤씨. 나는 한국사람아닌데요. 싱가폴사람이지만 조금 한국어 할수있어요 ㅋㅋㅋ.
Here is another way to lock the display. Remember to make a backup of your display first before doing this.
1. Paste this VBA code into your display
'Link this macro to a button Sub EnableControls() Dim password As String password = InputBox("Enter the password to enable the toolbar.") If password = "yoon" Then Dim i As Integer For i = 1 To Application.CommandBars.Count Application.CommandBars.Item(i).Enabled = True Next i End End If End Sub 'Disable the entire toolbar when the display is opened. Private Sub Display_Open() Application.RunMode = True Dim i As Integer For i = 1 To Application.CommandBars.Count Application.CommandBars.Item(i).Enabled = False Next i End End Sub 'Enable the toolbar when closing the display. Private Sub Display_BeforeClose(bCancelDefault As Boolean) Dim i As Integer For i = 1 To Application.CommandBars.Count Application.CommandBars.Item(i).Enabled = True Next i End End Sub 'Disable right-click when the toolbar is disabled. Private Sub Display_BeforeRightClick(bCancelDefault As Boolean, ByVal lvarX As Long, ByVal lvarY As Long) If ThisDisplay.Application.CommandBars.Item(1).Enabled = True Then 'nothing Else bCancelDefault = True MsgBox ("Right-click is disabled. Use the 'Enable Toolbar' button to enable right-click.") End If End Sub
2. Create a button symbol to execute the EnableControls() macro.
3. Change the password highlighted in red above from 'yoon' to whatever you want.
4. Save and close the display.
5. The next time you open this display, it will be locked in run mode and all toolbars are disabled.