User Defined Type (UDT) as parameter in public Sub in class module (VB6)

Just define the sub as Friend scope. This compiles fine for me in a VB6 class.

Private Type testtype
  x As String
End Type


Friend Sub testmethod(y As testtype)

End Sub

From your error messages it appears your class is private. If you do want your class to be public – i.e. you are making an ActiveX exe or DLL and you want clients to be able to access the sub – then just make both the type and the sub Public.

Leave a Comment