Get alarm messages in VBA

Get alarm messages in VBA

Hi,
I need to write macro in my project, that will get alarm messages from variables in alarm and write it to string variable.
I have created the macro, but it doesn`t work. Could you please help me, may be some advises or recomendations?
Here is my code:
VBA Code:
Public Sub GetValues()
Dim zVariables As Variables
Dim zVariable As Variable
Dim obAlarm As Alarm
Dim obAlarmItem As AlarmItems
Dim infoTagName As String
Set zVariables = thisProject.Variables
Set zVariable = zVariables.Item("var_alarm_string")
Set obAlarm = thisProject.Alarm
Set obAlarmItem = obAlarm.AlarmItems
Set infoText = obAlarm.Item.Tagname
Set zVariable.Value = infoText
End Sub


Regards, Nataliia

This is a migrated post! Originally posted on 28.06.2013 by user croc. Please be aware that information can be outdated.