Property Let

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,072
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I can pass one variable ok, but I need to pass 2.
Doesn't seem to work.. Is there an example with 2 variables?
Code:
Public Property Let iItem (aa As String, v As Integer)
... do stuff
End Property

Dim Test as Popup
Set Test = New Popup
Test.iItem = "Fred", 9

("Fred", 9) in brackets nogo either.
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Can you provide more background/code on what you're trying to do.

I'm guessing that .iItem consists of item and key, but it's not clear why each instance of Popup would have only one .iItem?
 
Upvote 0
No, it's isn't an item/key. I just can't pass in both variables and Google help isn't clear if I should be able to or not.
 
Upvote 0
Why not pass an array, e.g.

Code:
Public Property Let iItem(v As Variant)
' .....


Test.item = Array("Fred", 9)
 
Upvote 0
Sure thing.. I also split a string. So one parameter is the limit. Wanted to prove that.. I found some MS stuff
that indicated other options existed but not explained well.
 
Upvote 0
You can write a procedure within the Popup class to accept multiple arguments, to assign to multiple properties, e.g.

Code:
Sub Test()

    Dim x As Popup
    Set x = New Popup
    
    x.SetDetails "Fred", 9
    
    MsgBox x.Name
    
End Sub

'Popup Class
Dim sName As String, lNumber As Long
Public Sub SetDetails(s As String, i As Long)
    sName = s
    lNumber = i
End Sub

Public Property Get Name() As String
    Name = sName
End Property

Public Property Get Number() As Long
    Number = lNumber
End Property
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top