Showing results 1 to 5 of 5

Thread: Vba macro should run every 1sec without any external trigger from runtime

  1. #1
    Join Date
    07.04.2021
    Posts
    5

    Ausrufezeichen Vba macro should run every 1sec without any external trigger from runtime

    Hi, I am using ZENON 8.20 Version, I need to take The Total no. of alarm values into historian, but it is an Screen specific type function, I am not able to take the value so i am using the VBA macro to take the value into variable, But everytime i need to trigger the function *Execute vba macro* in my case the macro should fetch data every 1 sec, i am attaching my source code, please anyone can help me

    Public Sub GetAlarmItems()
     Dim zAML As Alarm
     Dim zAML_Items As AlarmItems
     Dim zAML_Item As AlarmItem

     set zAML = thisproject.Alarm

     thisproject.Variable.Item("TEST_E").value = zAML.Items.Count

    End Sub



    How can I modify this program to get data every 1 sec, Here my variable is TEST_E

  2. #2
    Join Date
    10.12.2007
    Posts
    275

    Default AW: Vba macro should run every 1sec without any external trigger from runtime

    You could use a zenon timefunction to call the Run VBA Macro function every 1s - but I would not recommend. That might block your runtime.

    Take a look at alarmareas. You could create an alarmarea, assing it to all variables. The alarmarea is able to count the active alarms. No need for VBA

  3. #3
    Join Date
    18.12.2017
    Posts
    44

    Default Re: Vba macro should run every 1sec without any external trigger from runtime

    Hi!

    As mst wrote, it´s better to use the built in functionality.
    If you just want to find out the total number of alarms in the project, why not use the system variable "[Alarms]Number of alarms"?


  4. #4
    Join Date
    07.04.2021
    Posts
    5

    Default Re: AW: Vba macro should run every 1sec without any external trigger from runtime

    Thank you very much It is working now.

    I have one more issue I need to send a variable data to an SQL database through VBA every 1sec,

    It is posssible to send data through VBA ?, If so i need to know the proramming code for VBA

  5. #5
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    1,039

    Default Re: Vba macro should run every 1sec without any external trigger from runtime

    this thread becomes the duplicate of I need to push data from Zenon VBA to SQL database every 1sec (copadata.com) and anyway was about topics not specific for energy. I'm moving it to another node.


Similar Threads

  1. Zenon runtime 8 does not execute VBA macro
    By Anthony75fr in forum VBA
    Replies: 0
    Last Post: 23rd October 2020, 23:49
  2. Allocation is not following the trigger variable status
    By Anas_FAISAL in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 2
    Last Post: 19th February 2020, 15:34
  3. Start/Stop Arvhive on PLC Trigger
    By joebloggs in forum Drivers
    Replies: 3
    Last Post: 13th February 2020, 10:10
  4. How turn on/off the revision for external variables
    By tsvoboda in forum Add-In Framework
    Replies: 2
    Last Post: 15th October 2019, 13:55
  5. variables external use
    By nikabena in forum Engineering Studio Logic & Logic Service (former zenon Logic Workbench & Runtime)
    Replies: 2
    Last Post: 10th June 2015, 16:39

Tags for this Thread

Posting Rules

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