ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   type variable as argument of a sub (https://www.excelbanter.com/excel-programming/280356-type-variable-argument-sub.html)

Koos

type variable as argument of a sub
 
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


Chip Pearson

type variable as argument of a sub
 
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


"Koos" wrote in message
...
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





All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com