Results 1 to 2 of 2

Thread: cannot return my own user type to variant function

  1. #1

    Thread Starter
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179

    Unhappy cannot return my own user type to variant function

    i have following error:
    Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types


    This error has the following cause and solution:

    You attempted to use a public user defined type as a parameter or return type for a public procedure of a class module, or as a field of a public user defined type. Only public user defined types that are defined in a public object module can be used in this manner.



    this is my code:
    Code:
    Option Explicit
    Private Type xmlKLANT
        KLANT_ID As Integer
        KLANT_NAAM As String
    End Type
    
    Private Sub Command1_Click()
     Dim vThingie As Variant
        ParseXML "blab", vThingie
    End Sub
    
    Public Function ParseXML(sText As String, ByRef vThing As Variant)
    Dim xKlant As xmlKLANT
       vThing = xKlant
    End Function

    how can i return my own user-defined type to the variant?
    the purpose is to create a general function that can return different usertypes by parsing the text.

  2. #2

    Thread Starter
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179
    i have created the dll with the types defined in it.
    then i have compiled it.

    how can i now use it (reference it?). please point this out to me.
    thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width