private types

  • Thread starter Thread starter Jesper F
  • Start date Start date
J

Jesper F

I'm getting a "Compile error - user-defined type not defined" with this :

In declarations:
Private Type SelDim
iWidth As Integer
iHeight As Integer
End Type

In the module:
Function SelectionDimension() As SelDim
SelectionDimension.iWidth = 3
SelectionDimension.iHeight = 4
End Function

What's wrong? Thanks.


Jesper
 
Where are you getting the error? The function would have to be a private
function in order to return a private type. Could the problem be that you
are calling the function from outside of this module?
 
Where are you getting the error? The function would have to be a private
function in order to return a private type. Could the problem be that you
are calling the function from outside of this module?

You're right private/public and calling it from outside the module.
Thanks!

Jesper
 
I'm getting a "Compile error - user-defined type not defined" with this :

In declarations:
Private Type SelDim
iWidth As Integer
iHeight As Integer
End Type

In the module:
Function SelectionDimension() As SelDim
SelectionDimension.iWidth = 3
SelectionDimension.iHeight = 4
End Function

What's wrong? Thanks.


Jesper

I think maybe it's the way you're using it. I just noodled around with this for
a few seconds and I didn't get an error.

Function fSelectionDimension() As String
Dim SelectionDimension As SelDim
SelectionDimension.iWidth = 3
SelectionDimension.iHeight = 4
fSelectionDimension = SelectionDimension.iWidth & ", " &
SelectionDimension.iHeight
Debug.Print fSelectionDimension
End Function

Result was 3, 4.

HTH,
RD
 
Back
Top