Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Intrinsic Constants for a Class 1

Status
Not open for further replies.

jstiegelmeyer

Programmer
Dec 31, 2002
27
US
I would like to set up some predefined constants for use as arguments in routines stored in my class.

I'd like for the names of the constants to pop up as suggestions when I'm calling the routines. If this isn't very clear, it's because I'm not sure how to state it. Let me try an example.

Inside my class, I have a routine:

Public Sub PrintReport(strRptType as string)

There are two kinds of reports, "Brief" and "Narrative". I'd like to set up two constants inside my class:

cBrief = "Brief"
cNarr = "Narrative"

And when I call PrintReport using an instance of the class, I can type in:

Call PrintReport(cBrief)

How do I declare cBrief and cNarr to make this possible? Is it possible that after I type "Call Print Report(" that "cBrief" and "cNarr" would appear as options for me to select.

A similar example:

MsgBox "Message", vbInformation + vbOKOnly

I want cBrief and cNarr to appear in a list just like vbInformation and vbOKOnly appear when calling the MsgBox routine.

This isn't a big deal, but something I've been trying for a while to figure out. I anybody has the answer to this, I would love to hear it!

Thanks,
Jamie
 

Something like...
[tt]
Option Explicit

Public Enum MyEnum
MyValue1 = 1
MyValue2 = 2
End Enum

Public Sub MyFunction(WhatAction As MyEnum)

End Sub

Public Sub test()
MyFunction MyValue1
End Sub
[/tt]

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top