Simple VBA code to write PLC Tag...

Mayank Dubey

Member
Join Date
Oct 2013
Location
Indore
Posts
5
Hello Friends....
I am trying to read & write the PLC tags through VBA code but not getting correct syntax, i m using FTView SE 6.0
Your help will be highly appreciable...

Thanks in Advance!!
 
No need for VBA Dubey

Just in view se , click the object ( Ex Numeric Ip) in that click the connetions ,,in that pop up u will see ur PLC program topic,, just select ur plc topic -> Online Tags -> In that select the Numeric field u want to configure it.... just run the scada u will be able to monitor the numeric value in scada...

C the topic - Setting up DDE communications for HMI tags in view se user manual

Regards,
Nelliyan.G
 
Create a tag group, add the tag(s) you need to the group. Then make the assignment, and use the "WritePendingValues(TagsInError)" method of the tag group to update them.

Tag_str = "{[" & IOTopic & "]MyDigitalTag}"
Set HMITag = MyGroup.Item(Tag_str)
HMITag.PendingWriteValue = 0
Results = MyGroup.WritePendingValues(TagsInError)
 
Thanks RDRAST....for the code but I get some compile errors while execution, will u please supply with the variable declarations used in the code....As I don't have much idea about the syntax and declarations used in VB.
 
No need for VBA Dubey

Just in view se , click the object ( Ex Numeric Ip) in that click the connetions ,,in that pop up u will see ur PLC program topic,, just select ur plc topic -> Online Tags -> In that select the Numeric field u want to configure it.... just run the scada u will be able to monitor the numeric value in scada...

C the topic - Setting up DDE communications for HMI tags in view se user manual

Regards,
Nelliyan.G

I used this procedure to link the tags but this time I want to connect via VB.
 
Dim Tag_Str as String
Dim MyGroup as TagGroup
Dim HMITag as Tag

If I recall correctly.

I have button1 on display in FT View SE and trying to set the tag "DigTag" after the button is released,IO_SERVER is the PLC_Shortcut,
I directly paste the tag path
Tag_Str={[IO_SERVER]DigTag}", prior i tried the syntax:
Tag_Str= "{[" & IO_SERVER & "]DigTag}"
but it was showing value- Tag_Str= "{[]DigTag}"

The code written is as follows:

Dim My_Group As TagGroup
Dim HMITag As Tag
Dim Tag_Str As String

Private Sub Button1_Released()
Tag_Str = "{[IO_SERVER]DigTag}"
Set HMITag = MyGroup.Item(Tag_Str)
HMITag.PendingWriteValue = 0
Results = MyGroup.WritePendingValues(TagsInError)
End Sub

on execution run-time error occurs '424' object required and on debug it highlights to third line of progrm.
Any idea about the error or what object to add??
 
Reading a Tag in VBA ,,,, Test s the TAG GROUP created in tags ,Data 1 is the the tag created inside the TagGroup Test..


Private Sub Button3_Released()
Dim Test As TagGroup

Set Test = Application.CreateTagGroup("/")
Dim X As Tag
Test.Add "Test\Data1"
Set X = Test.Item("Test\Data1")

MsgBox X.Value // the value in the tag will pop up//

End Sub
 

Similar Topics

I'm guessing it's just Monday but I'm having a major brain ****... I have 4 drives that I need to start in any order (i.e. - 1,2,3,4 or 2,3,1,4...
Replies
0
Views
1,382
I am a newby to VB in Excel. The only thing I cannot make work is to display string data in a textbox on a userform. I have the following code...
Replies
3
Views
2,918
Hello, I´m having a problem trying to program in Ladder. An output should be trigged by two possible contacts. Take a look on the printscreen...
Replies
5
Views
153
Hello again..trying something on an existing poorly written program and just wanted to double check something system is an A-B MicroLogix 1200 In...
Replies
5
Views
178
Hi all, Writng a FB in ST on Beckhoff TC for a pulser which turns on and off on a cycle, is paused by turning bControlInput to FALSE, but resumes...
Replies
6
Views
270
Back
Top Bottom