Using Enum properly

Posted on 2000-01-27
Medium Priority
Last Modified: 2010-05-02
What i want to accomplish is: When creating a sub with values being passed to it, i would like it to show a drop down list of posiblities, kinda like if i were to make a public enum then use that enum in the Private Sub MySub(enum). the problem is when calling it i have to type MySub enum.enumvalue. I only get a list of enums when i type the actual name of the enum followed by a period. Many built in methods of basic use something similar to the enum to show the programmer a list when calling that method but none make you type the name of the enum first then a period. they all work buy simply displaying a list of enums which the programmer can choose from. how can i replicate this same behavior? sorry i cant give more points i only have 19 left!

Question by:Jaysor

Accepted Solution

Vbmaster earned 40 total points
ID: 2394010
If your enum is called enummm then in the SUB declaration put

SUB somename(somevariable as enummm)
LVL 32

Expert Comment

ID: 2394011
Enum E
End Enum

Private Sub Form_Load()
S three 'List appears
End Sub

Private Sub S(en As E)
    Debug.Print en
End Sub

Author Comment

ID: 2394045
since you were the first to answer you get the points.. thanks!


Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As a person who answers a lot of questions, I often see code that could be simplified, made easier to read, and perhaps most importantly made easier to maintain if the code was modified to use the Select Case statement. This article explains how to…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question