type variable as argument of a sub

  • Thread starter Thread starter Koos
  • Start date Start date
K

Koos

Hello all,

I am not very experienced in excel programming. But I am wondering
whether it is possible to pass a type variable as an argument to a sub
or function. I am using excel 97 sr-2.

thanks in advance,
Koos
 
Koos,

Do you mean a structure variable defined with the Type identifier? If so,
then the answer is yes, you can pass types to procedures. For example,

Public Type TheType
X As Integer
Y As Integer
End Type

Sub AAA()
Dim T As TheType
T.X = 123
T.Y = 456
BBB T
End Sub

Sub BBB(TT As TheType)
Debug.Print TT.X
Debug.Print TT.Y
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (e-mail address removed)
 
Back
Top