Using a user defined type and the Split Function
Hey guys,
I have another problem with the split function. I can get the split funtion to work fine for user-defined types (String, integer, ect..) What I want to do is get the Split function to work on a user-defined type. Here is my user-defined definition that I created in a module:
Public Type MyStruct
First As String
Last As String
Phone As Long
Salary As Double
End Type
Here is the code I am trying to use to send the contents of the split string into this type:
Option Compare Database
Option Explicit
Private Container As MyStruct
Public Sub Command0_Click()
Dim s As String
s = "Tim Mcarthy 8889099221 13000.93"
Container = Split(s, " ")
MsgBox Container.First
MsgBox Container.Last
MsgBox Container.Phone
MsgBox Container.Salary
End Sub
This is the error message I am receiving:
"Only user defined types defined in public object modules can be coerced to form a variant or passed to late bound function"
Any suggestions?
nikotromus
__________________
nikotromus
|