Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
quick question: is there a smart way to define a procedure to do the same thing as a "public let", but with the array syntax? i.e. you can easily do MyObject.MyValue = 10 with a "public let", but is there a way to do: MyObject.MyArray(3)=10 Thanks in advance Charles |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Forgot to mention that I am using VBA
|
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
And since Christmas is coming, what about having also the flexibility
to use it in the other way, i.e. xx = MyObject.MyArray(3) |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Based on a wild guess as to at what you're doing, arrays cannot be Public in
a Class module. Maybe something like - ' code in Class1 Private arr(1 To 10) As Long Public Property Let propArray(idx As Long, n As Long) arr(idx) = n End Property Public Property Get propArray(idx As Long) As Long propArray = arr(idx) End Property ' code in a normal module Dim myObject As Class1 Sub test() Set myObject = New Class1 myObject.propArray(3) = 10 MsgBox myObject.propArray(3) Set myObject = Nothing End Sub Regards, Peter T "Charles" wrote in message oups.com... Hello quick question: is there a smart way to define a procedure to do the same thing as a "public let", but with the array syntax? i.e. you can easily do MyObject.MyValue = 10 with a "public let", but is there a way to do: MyObject.MyArray(3)=10 Thanks in advance Charles |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Peter
thanks for your answer. This is exactly what I wanted to do. I wasn't aware that by defining the procedure "Public Property Let propArray(idx As Long, n As Long)" you could also use it by doing "myObject.propArray(3) = 10" instead of something like "myObject.propArray(3,10)" . It is much more intuitive to use your way. Thanks very much! Charles |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Assign name to chart object? | Excel Programming | |||
assign objects into array or object variable? | Excel Programming | |||
Can't assign a textbox to object | Excel Programming | |||
Can't assign a textbox to object | Excel Programming | |||
assign the sub to the object event | Excel Programming |