title: Sparx Enterprise Architect to get the Tagged ´Value from otDiagram VB Script code
body: <p>I have a UML diagram and all the component has tagged values . I would like to retrieve the tagged value with the element name .  Something like this to get the tagged value that i have code but dont know how to start it for a diagram.</p>
  
  <pre><code>function TVGetElementTaggedValue( theElement, taggedValueName, defaultValue )
      TVGetElementTaggedValue = defaultValue
  
      if not theElement is nothing and Len(taggedValueName) &gt; 0 then
          dim taggedValue as EA.TaggedValue
          set taggedValue = theElement.TaggedValues.GetByName( taggedValueName )
  
          if not taggedValue is nothing then
              TVGetElementTaggedValue = taggedValue.Value
          end if
      end if
  
  end function
  </code></pre>