using HMI Tag in VBA FactoryTalk SE

kuk

Member
Join Date
Jan 2021
Location
TN
Posts
2
Hi,


how can i use a defined Tag in HMI Tags (for exampele dintTag )

in VBA code by a display.



i am using FactoryTalk SE



thanx
 
The following were written in VBA for ViewStudio. Not sure how similar FactoryTalk View is.

Code:
Function GETtagVal(TagName As String) As Variant
'Return value of a RsView TagDB TAG. (Without leaving pointers in memory!)
Dim MyTag As Tag
On Error GoTo ErrHandler
  Set MyTag = gTagDb.GetTag(TagName)
  GETtagVal = MyTag.Value
  Set MyTag = Nothing
Exit Function
ErrHandler:
  gActivity.Log "VBFunc:GETtagVal(" & TagName & ") - " & Err.Number & " " & Err.Description, roActivityError
  Err.Clear
End Function

Sub SETtagVal(TagName As Variant, Val As Variant)
'Set on RsView TagDB TAG <TagName> value of VAL. (Without leaving pointers in memory!)
Dim MyTag As Tag, sMsg As String
On Error GoTo ErrHandler
  Set MyTag = gTagDb.GetTag(TagName)
  MyTag.Value = Val
  Set MyTag = Nothing
Exit Sub
ErrHandler:
  sMsg = "VBSub:SETtagVal(" & TagName & ", """
  If IsNumeric(Val) Then _
       sMsg = sMsg & str(Val) & """) - " & str(Err.Number) & Err.Description _
  Else sMsg = sMsg & Val & """) - " & str(Err.Number) & Err.Description
  gActivity.Log sMsg, roActivityError
  Err.Clear
End Sub

Nick
 

Similar Topics

Hi, I am trying to create a list of tags with status, reference and description using Microsoft List view Control 6.0 and VB code behind the...
Replies
3
Views
5,169
Hello everyone, I am trying to change the IP address of the Omron PLC (NJ30-1200) and HMI (NB7W-TW01B) to fetch the network on our network...
Replies
7
Views
257
Hi all so i have a robot project im working on were i need to set the layers. using the hmi screen i would like to use the numeric data display to...
Replies
11
Views
768
I've been tasked with modifying a current hmi program for the addition being added to the cell (auto/manual ,I/O ,Status). When I try to upload...
Replies
2
Views
390
Hi All I am busy with a Project that will use the same Application on 2 HMI's . I have a Allen Bradley L330ERS PLC and 2x 5510 HMI. What i...
Replies
3
Views
677
Back
Top Bottom