View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ulrich Möller Ulrich Möller is offline
external usenet poster
 
Posts: 7
Default Problem getting a pointer to a User Defined Type (UDT)

Am 17.05.2018 um 15:01 schrieb Desmond Walsh:
I have a data structure consisting of an array of User Defined Types (UDF) - called Udta say. Each Udta contains 4 members that are also UDT's - called Udtb say. I wrote a function to return a pointer to a specific Udtb. But to my surprise, the pointer creates a new instance of Udtb although it inherits from the Udtb I was trying to point to.

I have confirmed this behaviour by monitoring the variables in Local Window. I also display the pointer values using VarPtr.

My question. Is it possible to get a pointer to a specific Udtb as I am trying to do. It seems to me that I want 2 pointers pointing at the same UDF. I would prefer to stay with UDT's and not use classes.

The code is vba in Excel 2010.


Here you will find some detailed information about vba pointers:
https://bytecomb.com/vba-internals-a...ters-in-depth/
https://communities.bentley.com/prod...roperty-values

Therefore i would prefer objects instead udts andÂ* and pass them by
reference.

Ulrich