XML Deserialization in VB/VBA

Posted by oharab on Stack Overflow See other posts from Stack Overflow or by oharab
Published on 2010-04-27T09:21:48Z Indexed on 2010/04/27 9:23 UTC
Read the original article Hit count: 602

I have a set of VBA classes in an MS Access database. I have an xml string with data I want to create new classes with.

Other than setting each property individually, is there an easy way to deserialize the XML into my object?

I've seen the code using the TypeLib library

Public Sub ISerializable_Deserialize(xml As IXMLDOMNode)

  Dim tTLI As TLIApplication
  Dim tInvoke As InvokeKinds
  Dim tName As String
  Dim tMem As MemberInfo

  tInvoke = VbLet

  For Each tMem In TLI.ClassInfoFromObject(Me).Members

     tName = LCase(tMem.Name)

     CallByName Me, tMem.Name, VbLet, xml.Attributes.getNamedItem(tName).Text

  Next tMem
End Sub

but this doesn't seem to work with the standard class modules. I get a 429 error:

ActiveX Component Cannot Be Created

Can anyone else help me out? I'd rather not have to set each propery by hand if I can help it, some of these classes are huge!

© Stack Overflow or respective owner

Related posts about vb6

Related posts about vba