Page 1 of 2 1 2 LastLast
Showing results 1 to 10 of 11

Thread: Access to Alarm Classes

  1. #1
    Join Date
    01.12.2009
    Posts
    23

    Rotes Gesicht Access to Alarm Classes

    Hello

    I need to get colors from Alarm Classes defined in Projest\Variables\Alarm\Alarm Classes in SCADA-Editor. How can I do it?
    Thank you.

  2. #2
    juergen_fruehwirth Gast

    Default Re: Access to Alarm Classes

    hello

    take a look on following thread where the handling of alarm classes/groups/areas via VBA is described: http://www.copadata.com/forums/showt...&mode=threaded

  3. #3
    Join Date
    01.12.2009
    Posts
    23

    Default Re: Access to Alarm Classes

    I'm sorry but code

    MyWorkspace.ActiveDocument.DynPropertiesEnum("")

    fails with "Run-time error 91: Object Variable or With block variable not set"


    as well as
    a1 = MyWorkspace.ActiveDocument.DynProperties("AlarmClasses")

    Last edited by olga : 2nd December 2009 at 12:56

  4. #4

    Default Re: Access to Alarm Classes

    You may be interested to know, that COPA-DATA offers 1 day VBA Integration trainings on a regular basis, at the COPA-DATA headquarters in Salzburg, or on site as well.

    Also you can find many VBA samples not only here in the forums, but also in the VBA help which is included in the zenon online documentation.

    the "DynpropertiesEnum returns an array of variant. The proper use is displayed in the sample below:

    Sub enm()
    Dim enumResult
    enumResult = MyWorkspace.ActiveDocument.DynPropertiesEnum("")
    End Sub

    The "ActiveDocument" refers to the currently active project in the workspace. Therefore, please make sure that you have activated the correct project in the editor!

  5. #5
    Join Date
    01.12.2009
    Posts
    23

    Default Re: Access to Alarm Classes

    Good morning!

    Here is function code I tried to trace:
    Function getColorFromAlarm(AlClass) As Long
    Dim en
    getColorFromAlarm = RGB(0, 0, 0)
    'If MyWorkspace.ActiveDocument.DynProperties("AlarmClasses") > 0 Then
    '    getColorFromAlarm = MyWorkspace.ActiveDocument.DynProperties("AlarmClasses[" & Trim(Str(AlClass)) & "].Color")
    'End If
    en = MyWorkspace.ActiveDocument.Name
    End Function

    Even MyWorkspace.ActiveDocument.Name failed with error 91.
    May be it's because the version of my SCADA - 6.22 - isn't the latest...

  6. #6
    juergen_fruehwirth Gast

    Default Re: Access to Alarm Classes

    hello,

    because of the error 91 it seems that you are trying to use this code in the zenon runtime, am i right?
    there is a difference (in the objects used) between using vba code in the zenon editor and in the runtime.

  7. #7
    Join Date
    01.12.2009
    Posts
    23

    Default Re: Access to Alarm Classes

    Yes, I try to use it in Runtime.
    I didn't use VBA in Editor Please explain me how to do this I started to learn SCADA-VBA not long ago

  8. #8
    Join Date
    01.12.2009
    Posts
    23

    Default Re: Access to Alarm Classes

    And how can I get colors from AlarmClasses in Runtime?

  9. #9
    juergen_fruehwirth Gast

    Default Re: Access to Alarm Classes

    it is not possible to access the alam classes via the runtime!
    not all elements that are accessible via vba in the zenon editor are accessible in the runtime.
    difference programming editor <-> runtime: to say it in short: you work with different objects
    - editor: e.g. MyWorkspace.ActiveDocument.Variables....
    - runtime: e.g. thisProject.Variables...

    may you take a look on the vba chapter in the zenon help or take a look on some articles in this forum to get an impression on the programming possibilities.

  10. #10
    Join Date
    01.12.2009
    Posts
    23

    Default Re: Access to Alarm Classes

    Hello!

    I even cannot get variables in SCADA-Editor:
    vc = Application.MyWorkspace.ActiveDocument.Variables.Count

    An error 429 "ActiveX component cannot create object" appears.
    How can I access to variables in Editor? Or may be it's because of the old version of SCADA?

Similar Threads

  1. Access New CEL item event from VBA
    By karimsaikali in forum VBA
    Replies: 7
    Last Post: 12th March 2009, 08:56
  2. Alarm Status Line and Alarm List
    By tomaslipa in forum zenon Supervisor
    Replies: 1
    Last Post: 21st January 2009, 12:02
  3. VBA and Microsoft Access
    By bjoerndavid in forum VBA
    Replies: 2
    Last Post: 30th November 2007, 22:22

Posting Rules

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