title: How to put user defined datatype into a Dictionary
body: <p>I'm trying to define my own data type and put it in a Dictionary as a value. VBA complains that it does not accept my data type. Any ideas about how to get this working?</p>
  
  <pre><code>Option Explicit
  
  Public Type Translation
      german As String
      french As String
      italian As String
  End Type
  
  Private resource As Object
  
  Public Sub addTranslation(key As String, g As String, f As String, i As String)
      Dim trx As Translation
      trx.german = g
      trx.french = f
      trx.italian = i
  
      resource.add key, trx  '&lt;== here VBA is complaining
  End Sub
  
  Public Sub initResource()
      If resource Is Nothing Then Set resource = CreateObject("scripting.dictionary")
  End Sub
  </code></pre>
  
  <p>This is the error messge:</p>
  
  <blockquote>
    <p>Only user-defined types defined in public object modules can be coerced to or from a variant or passed to late-bound modules.</p>
  </blockquote>