Accessing String Variable Value At VBA
hi,
I am tryig to read and write an internal string variable using VBA on zenon V11. While I've managed to successfully write to the variable, I'm encountering a bit of a challenge when attempting to read its value. I'm receiving a Run Time Error whenever code runs. Is there anything should be enabled in order to read a string variable value in a VBA code.
Below is my simple code that I get error;
Public Sub LeftClickUp_Show_Note(obElem As Element)
Dim obPosVar As Variable
Dim obNoteVar As Variable
Set obPosVar = thisProject.Variables.Item(obElem.ItemVariable(0).Name)
prefix = Mid(obPosVar.Name, 1, InStr(obPosVar.Name, "!") - 1)
Set obNoteVar = thisProject.Variables.Item(prefix & "!" & prefix & "_Note")
'No error when writing the value
obNoteVar.Value = "something"
'Getting error when trying to access the same value
msgbox(obNoteVar.Value)
End Sub