FTView and VBA - Reading memorytag

MortenB

Member
Join Date
Apr 2016
Location
Fredrikstad
Posts
16
Hi

I'm trying to do the simplest of readings. Read a memorytag in VBA and then show a display if the tag is set.

However I get an errormessage in my code. The error is "Run-time error '424': Object required.

My code is:
Code:
Public Sub NumericDisplay1_Change()
    Dim MyTag As Tag
    Dim MyTagValue As Variant
    Dim Tagname As String
    Tagname = "MES_Tags\P_Avd\Slurryanlegg\NyReseptMottatt"
    Set MyTag = gTagDb.GetTag(Tagname)
    MyTagValue = MyTag.Value

    Set MyTag = Nothing
    If MyTagValue = 1 Then
        ShowDisplay ("popup_slurryresept_P_anlegg")
    End If

End Sub

The error points to the line:
Code:
Set MyTag = gTagDb.GetTag(Tagname)

I'm pretty new to both FTView and VBA.
Running FTView 7 by the way.
 
Ive always done it this way:
Code:
    Set MyTagGroup = Application.CreateTagGroup("/")
    Set minuteTag = MyTagGroup.Add("system\Minute")

So yours would be:
Code:
    Set MyTagGroup = Application.CreateTagGroup("/")
    Set MyTag= MyTagGroup.Add("MES_Tags\P_Avd\Slurryanlegg\NyReseptMottatt")

Ash
 

Similar Topics

Hi all. Currently I'm working on a VBa script for FTView. I would like to understand a bit better about some commands. 1) What are the...
Replies
3
Views
595
Hi all. I'm running a VBA code on my FTView which is actually working, but everytime I open the display that calls the VBA code, it throws the...
Replies
28
Views
1,803
Greetings, I have this question: How can I add a tag, in my case LS:0 {#5} (literal string of tag #5), to a variable using VBA? I couldn't find...
Replies
4
Views
894
Hello Every one, I need a help on vba code for getting data from MSSQL server 2014 to display in FTview SE client version 12 . Thanks. Please...
Replies
4
Views
1,811
I've been messing around with trying to find a way to clear all PlantPAx AOI latched alarms via the Alarm Banner or Summary objects. So far, I can...
Replies
2
Views
1,735
Back
Top Bottom