Access to the control element via VBA

Access to the control element via VBA

I have an image with a control element of the type Compatible Elements (Lock). 
Depending on the logged in user, the name and lockCode should be entered in the control element.

My code below:

Sub GetUser()
    Dim zUser As user
    Dim activeUser As variable
    Dim lockCode
    Dim zPic As dynPicture
    Dim zElem As Element
        
    Set activeUser = thisProject.variables.Item("Username")
    Set zUser = thisProject.Passwords.ItemUser(activeUser.Value)
    
    lockCode = zUser.DynProperties("LockCode")
    Debug.Print "active Username: " & zUser.name & ", LockCode: " & lockCode
    Set zPic = thisProject.DynPictures.Item("Picture_ON_OFF")
    Set zElem = zPic.Instances.Item(0).Elements.Item("Logged_User")
End Sub