PDA

View Full Version : [SOLVED] Custom Data Type ?



mvidas
08-17-2004, 06:17 AM
Hi Everyone,

I'm wondering if the following is possible in VBA. In some code I'm making, I'm creating a flag variable.
You know how if a variable is declared as a boolean, and you put VariableName= a little box comes up giving you the choices of true and false? Is that possible for a custom format? I have a variable in my code called SurroundCell that I'd like to have only three choices available for it (vNoSurround, vSurroundAll, vSurroundDelim). Currently I'm using this code:


Dim vNoSurround As Integer, vSurroundAll As Integer, vSurroundDelim As Integer
Dim SurroundCell As Integer
vNoSurround = 0: vSurroundAll = 1: vSurroundDelim = 2
SurroundCell = vNoSurround

which works for what I need, but I'd rather it offer me the three choices when I type SurroundCell=

Is this possible? If it is, is it too much work to accomplish? It's not really necessary for me, just something I thought would be nice.

Thanks!
Matt

Steiner
08-17-2004, 07:33 AM
I don't know which version of VBA supports enumerations (at least Office97 does not), but give it a try:


Private Enum SurroundType
vNoSurround = 0
vSurroundAll = 1
vSurroundDelim = 2
End Enum
Private SurroundCell As SurroundType

mvidas
08-17-2004, 08:46 AM
Perfect!! Just what I was looking for, thanks Steiner!