daro

PLC RSLOGIX 5000 and VBA references

3 posts in this topic

hello.

I'm looking for an automation interface manual of rslogix 5000, just like the one for rslogix500. the idea is to skip OPC and just use VBA directly.

I had looked for this thing on AB website but I just can´t find anything.

Share this post


Link to post
Share on other sites

This is what I found on the subject

https://rockwellautomation.custhelp.com/app/answers/detail/a_id/22114

How to read and write to tags using vba on SE.

Basically:

Option Explicit
Public WithEvents oGroup As TagGroup ' Define a TagGroup

Public Function ReadTagValue(strTagName As String) As Variant
    Dim oTag As Tag

Set oGroup = Application.CreateTagGroup(Me.AreaName, 500) 'Set the tag group as being part of the Project
oGroup.Active = False 'Stop updating of tag group

On Error GoTo ErrorTrap

    oGroup.Add strTagName  'Add tag to TagGroup
    oGroup.Active = True 'Update Tag from PLC / DB
    Set oTag = oGroup.Item(strTagName) 'Define Tag
    Err.Clear 'Clear errors
    ReadTagValue = oTag.Value 'Get tag value and store it

    Set oTag = Nothing 'Clear tag
    Set oGroup = Nothing 'Clear Group

    Exit Function

ErrorTrap:
     LogDiagnosticsMessage "Error in ReadTagValue. Error: " & Err.Description
     Err.Raise Err.Number, "ReadTagValue()", "Error:" & Err.Description
 End Function

 

 

Edited by NorOntScout

Share this post


Link to post
Share on other sites

That's FT View SE. The OP was asking about RSLogix5000

 

To my knowledge, RA has not opened up the API/Object Model for RSLogix/Studio 5000.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now