Sub/Function Arguments

M

MPM1100

I am wondering if it is possible to provide options for Sub/Function
arguments just as VB does for intrisic methods, so that when a user is typing
out the method call, a drop down box appears for each argument showing
available options?

Thanks In Advance
 
S

Stuart McCall

MPM1100 said:
I am wondering if it is possible to provide options for Sub/Function
arguments just as VB does for intrisic methods, so that when a user is
typing
out the method call, a drop down box appears for each argument showing
available options?

Thanks In Advance

Yes, just set up Public Enums, like this:

Public Enum MyData_Enum
mdOption1 = 1
mdOption2 = 2
End Enum

Then, to specify it as a parameter data type:

Public Sub MySub(opt As MyData_Enum)
Select Case opt
Case 1: Debug.Print "Option 1 chosen"
Case 2: Debug.Print "Option 1 chosen"
End Select
End Sub

Not a very enlightening example, but hopefully you get the idea.
 
M

MPM1100

I posted this question in general questions too and got the answer just as
you have stated. Both answers are greatly appreciated.

Best

MPM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top