Property Let

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,835
Office Version
  1. 2019
  2. 2016
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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
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,214,403
Messages
6,119,308
Members
448,886
Latest member
GBCTeacher

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