PDA

View Full Version : [SOLVED:] Popup when calling function



marekba
02-07-2013, 09:32 AM
Dear all,

I would like to have a function that, when being written from a module, will display a list of available choices for the arguments.

What I would like is to have the same effect as when one writes the calling line of a function and comes to an argument that should be a boolean. Then comes a mini popup giving the choice True/False. I would like that to have the same but for a selection of 3 possibilities.

I am not sure if I explain this clearly enough...

Is this kind of possibility available? Maybe using Types? I've never used them before...

Thanks in advance for you help!

Jan Karel Pieterse
02-07-2013, 11:57 AM
Like so:


Option Explicit
Public Enum eTest
Value1
Value2
Value3
End Enum

Public Function Foo(MyArg As eTest)
MsgBox MyArg
End Function

Kenneth Hobs
02-07-2013, 05:09 PM
Public Type eTest
Value1 As Boolean
Value2 As Boolean
Value3 As Boolean
End Type

Sub Test()
Dim x As eTest, a() As Variant
With x
.Value1 = True
.Value2 = False
.Value3 = True
a() = Array("x.Value1: " & .Value1, "x.Value2: " & .Value2, "x.Value3: " & .Value3)
MsgBox Join(a(), vbLf)
End With
End Sub

marekba
02-07-2013, 11:43 PM
Hello both,

Thank you Jan, this is exactly what I was looking for! I didn't expect my explanation to be clear enough, but it looks like it was just fine :D

Cheers!

Jan Karel Pieterse
02-10-2013, 01:19 PM
Note that's behind the scenes, Value1 = 0, Value 2 = 1 and Value3 = 2. You can assign custom values like so:


Public eNum eTest
Value1=10
Value2=20
Value3=30
End Enum

marekba
02-11-2013, 01:33 AM
thanks for the update !