View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Show what options are in custom function?

You can't have the editor display the possible choices for an
argument unless the argument's type is Long. In this case, you
use an Enum type. E.g.,


Public Enum MyType
Modified = 0
Normal = 1
None = 2
End Enum

Function MyFunction(Arg1 As MyType)
' your code here
End Function

With enums, you don't have to supply the actual values, as show
in my example. If you omit the values, the first value will be
zero, and values will be sequentail. Note that enums are
supported in Excel 2000 at later.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"quartz" wrote in message
...
I am using Office 2003 on Windows XP.

Suppose you have a custom public function which requires
certain arguments.
Suppose further that one of those arguments could be one of
three choices.

When you call the function and open the parentheses you see the
listed
arguments. Is it also possible to show the three possible
choices for the one
argument?

Is so, could someone please illustrate how to do this? See
example function
below:

Public Function CalculateValue(argItem1, argItem2, argType) as
Long
If argType = "Normal" then ...
If argType = "Modified" then ...
If argType = "None" then ...
End Function

When I'm entering a call to the function as in: Call
CalculateValue(lngValue1, lngValue2, ...), when I get to the
point where I
need to enter the "argType" I want to see what my options are
(i.e. Normal,
Modified, or None). Kind of like auto-sensing.

Can this be done? If so, how? Thanks much in advance.