Sign in to follow this  
Followers 0
rswolff

FactoryTalk View SE

2 posts in this topic

after communicating to AB and getting references to articles that DON'T actually answer the question in any reasonable fashion, I'll ask here. Does anyone know the actual VBA code to read and write a value into a tag. It should be simple....I don't need a remote desktop, a recipe server, connections to a web based store, a cycling manual, a definition of what a tag is used for, why tags are a good thing, a comparison of FTView SE to RSView32, a collection of Rockwell plates.......there is apparently no manual, no list of VBA functions specific to FTView SE. I'm not looking for how to write VB code, or how VBA makes life better....simply want to be able to read a tag, and write a tag. Thanks, bob

Share this post


Link to post
Share on other sites
not quite sure what you are after. you can do many things without resorting to VBA. but if VBA is what you need, then you need to declare tag, point it to a tag in controller, then manipulate it to your liking. i assume that you are aware that VBA editor is accessed by pressing ALT+F11 and that you should name objects you place on screen. for example when you drop button for example and give it description, you should also go to Properties>Common>Name and name it something meaningful like btnStart, btnStop, etc so your code is more readable. try this code example Option Explicit Enum Tg Start = 1 Stop = 2 Reset = 3 ClearFault = 4 End Enum Public WithEvents PlcTags As TagGroup Private Sub Display_Load() Call SetUpTagGroup ' this has to be done when screen loads (executed once) ' End Sub Public Sub SetUpTagGroup() On Error Resume Next Err.Clear If PlcTags Is Nothing Then Set PlcTags = Application.CreateTagGroup(Me.AreaName, 500) If Err.Number Then LogDiagnosticsMessage "Error creating TagGroup. Error: " & Err.Description, ftDiagSeverityError Exit Sub End If PlcTags.Add "[PLC]From_HMI[0].0" '1 Start ' PlcTags.Add "[PLC]From_HMI[0].1" '2 Stop ' PlcTags.Add "[PLC]From_HMI[0].2" '3 Reset ' PlcTags.Add "[PLC]From_HMI[0].3" '4 ClearFault ' End If End Sub Private Sub btnStart_Press() Dim oTag As Tag Set oTag = PlcTags.Item(Tg.Start) oTag.Value = 1 End Sub Private Sub btnStop_Press() Dim oTag As Tag Set oTag = PlcTags.Item(Tg.Stop) oTag.Value = 1 End Sub ' etc. make sure to clear the bits in PLC at the end of the scan or create other function in HMI'

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
Sign in to follow this  
Followers 0