[RESOLVED] here's one for the purists
I have a button click event handler where an array QQ gets populated with Single values & I open a new Excel workbook & try to dump the values of QQ into it :
VB Code:
Private Sub button_Click()
Dim QQ() As MyType
ReDim QQ(3)
'...
'QQ gets populated correctly here...
'...
Set oXLApp = New Excel.Application
oXLApp.Visible = True
Set oXLBook = oXLApp.Workbooks.Add
Set oXLSheet = oXLBook.Worksheets(1)
oXLSheet.Range("A1:E9").Value = QQ
...
end Sub
where MyType is defined as
VB Code:
Private Type MyType
lZero As Single
lOne As Single
lTwo As Single
lThree As Single
End Type
I get compiler error :
"only UDTs defined in public object modules can be coerced to or from a variant or passed to late-bound functions"
What does this mean ??
I tried changing the button_Click() subroutine from Private to Public, but still get the same error. I would much rather understand the source of the problem than try to blindly correct it.
thanks,
Re: here's one for the purists
MyType has to be declared in a module. Go to the Visual Basic editor. right-click on This Workbook. Go to Insert. Select Module. Declare the public Type MyType there.