Hi there,
I have been looking in the forums for this and I saw a couple of examples but I still don't understand very well how to create a VBA script that will allow me to read a value of a PLC tag browsed from the RSlinx Enterprise file (Offline Tag File)
For the PLC I am using Studio 5000 V30.00
for the SCADA I am using FactoryTalk View Studio SE V9.00
What I am trying to do is:
1)Read variables from the PLC
2)Create a file (*.txt)
3)Write to that file the value of the variables
So far what I have is:
Dim File_System As Object
Dim File As Object
Dim Started as boolean
Dim File_Name As string 'this needs to change with date, any advice?
Dim Finished as boolean
Dim PLC_local_tag as integer
Started = ?????
Finished = ?????
PLC_local_tag = ?????? ' how do I read the value of a PLC tag?
If Started = 1 Then
Set File_System = CreateObject("Scripting.FileSystemObject")
Set File = File_System.CreateTextFile("C:\Users\Admin\Desktop\data\ " & File_Name & ".txt", True)
Else
End If
If Finished = 1 Then
File.WriteBlankLines ("2")
File.writeline ("==========")
File.writeline ("Number")
File.writeline ("*PLC TAG HERE*")
File.writeline ("==========")
Else
End if
Any help is appreciated, thanks!
PS. I don't know much about VBA.
I have been looking in the forums for this and I saw a couple of examples but I still don't understand very well how to create a VBA script that will allow me to read a value of a PLC tag browsed from the RSlinx Enterprise file (Offline Tag File)
For the PLC I am using Studio 5000 V30.00
for the SCADA I am using FactoryTalk View Studio SE V9.00
What I am trying to do is:
1)Read variables from the PLC
2)Create a file (*.txt)
3)Write to that file the value of the variables
So far what I have is:
Dim File_System As Object
Dim File As Object
Dim Started as boolean
Dim File_Name As string 'this needs to change with date, any advice?
Dim Finished as boolean
Dim PLC_local_tag as integer
Started = ?????
Finished = ?????
PLC_local_tag = ?????? ' how do I read the value of a PLC tag?
If Started = 1 Then
Set File_System = CreateObject("Scripting.FileSystemObject")
Set File = File_System.CreateTextFile("C:\Users\Admin\Desktop\data\ " & File_Name & ".txt", True)
Else
End If
If Finished = 1 Then
File.WriteBlankLines ("2")
File.writeline ("==========")
File.writeline ("Number")
File.writeline ("*PLC TAG HERE*")
File.writeline ("==========")
Else
End if
Any help is appreciated, thanks!
PS. I don't know much about VBA.
Last edited: