Showing results 1 to 3 of 3

Thread: VBA scripts by alarms events

  1. #1
    captain Gast

    Default VBA scripts by alarms events

    how can I choose time of operation and any other alarms events in archive and display them in a separate window?

  2. #2
    captain Gast

    Default Re: VBA scripts by alarms events

    Using following code:
    Public Sub LeftClickUp_TI(obElem As Element)
    Dim zVAR As Variable
    Dim zLimit As Limit
    Set zVariable = thisProject.Variables.Item("P_value")
    Set zLimit = zVariable.Limits.Item(0)
    
    Label20.Caption = thisProject.Variables.Item(zLimit).LastUpdateTime

    What am I doing wrong?

    Thanks for any input!

  3. #3
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: VBA scripts by alarms events

    - first you create an object of the variable with
    Set zVariable = thisProject.Variables.Item("P_value")

    - then you create an object of the first limit (based on zVariable) with
    Set zLimit = zVariable.Limits.Item(0)

    so far so good... but
    Label20.Caption = thisProject.Variables.Item(zLimit).LastUpdateTime

    can not work because at
    thisProject.Variables.Item() expects an ID or name of the variable
    .....it is not possible to put here the created limitobject (zLimit).

    what do you want to do with the limit (1st) of the variable?

    also take care that with zenOn Versions >= 6.22 it is not possible to direct read certain variable properties via VBA. The reading access has been resdricted for VBA for following variable functions:

    • Value
    • StatusValue
    • StatusExtValue
    • StatusString
    • LastUpdateTime
    • LastUpdateTimeMilliSeconds

    If you want to read one of above variable functions you have to take care, that the variable is advised. There are several postings in this forum which are dealing with this isue (Online Container, DDE active, ... ).

    So if the variable is advised the your code will work with following modification:
    Public Sub LeftClickUp_TI(obElem As Element)
    Dim zVAR As Variable
    Set zVariable = thisProject.Variables.Item("P_value")
    …
    Label20.Caption = zVariable.LastUpdateTime

    Please also take a look at the actual zenOn VBA documentation which includes many VBA examples dealing with this issue. This docu can be downloaded here (at the bottom is the last version):
    http://www.copadata.com/forums/showthread.php?t=37

    At the revision text (which is available on the zenOn DVD) the reading limitation via VBA is well described (see page 17)

    Regards,
    Herbert
    Last edited by herberto : 14th August 2008 at 09:34

Similar Threads

  1. VB scripts for WindowsCe platforms
    By martinw in forum zenon Operator
    Replies: 1
    Last Post: 12th June 2012, 13:21
  2. Circular Alarms/Events
    By consol in forum zenon Supervisor
    Replies: 1
    Last Post: 13th August 2008, 10:11
  3. Show more than 2841 Alarms on the ALARM picture
    By beer_klinkhammer in forum zenon Supervisor
    Replies: 2
    Last Post: 1st July 2008, 13:25
  4. How to have cumulative alarms time in report
    By fabios in forum zenon Supervisor
    Replies: 6
    Last Post: 21st May 2008, 10:08
  5. Renaming scripts loses the link at the function
    By markclemens in forum zenon Supervisor
    Replies: 0
    Last Post: 3rd August 2007, 07:23

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •