Results 1 to 35 of 35

Thread: [RESOLVED] Problem when passing UDTs to subs

Threaded View

  1. #1

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Resolved [RESOLVED] Problem when passing UDTs to subs

    In a module I have the following declarations:
    Code:
    Public Type MyUDT
       X As Single
       Y() As Single
    End Type
    '
    Public MyUDTInstance() As MyUDT
    In a different module:
    Code:
    Sub MySub(DummyVarName)
    '...
    ' Some operations are performed here
    'with the quantities:
    'DummyVarName(SomeIndex).X
    'and
    'DummyVarName(SomeIndex).Y(SomeOtherIndex)
    '...
    End Sub
    Finally, in a form there's the calling statement:
    Code:
    Call MySub(MyUDTInstance)
    Of course, MyUDTInstance and MyUDTInstance(SomeIndex).Y(SomeOtherIndex) have been previously ReDimensioned and given values.

    Now, when the sub is called I get the error you can see in the attached picture which can be translated into English more or less as follows:

    "Compiler error.

    Only those user defined types from public obejct modules can be passed to functions linked at run time or forced to or from a variant"

    Anyone knows the reason?
    Attached Images Attached Images  
    Last edited by krtxmrtz; Jun 28th, 2007 at 05:16 PM.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

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