Consulting

Results 1 to 3 of 3

Thread: Custom Data Type ?

  1. #1
    Knowledge Base Approver
    The King of Overkill!
    VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location

    Custom Data Type ?

    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

  2. #2
    VBAX Tutor
    Joined
    May 2004
    Location
    Germany, Dresden
    Posts
    217
    Location
    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
    Last edited by Steiner; 08-17-2004 at 07:39 AM. Reason: Modified code to match example

  3. #3
    Knowledge Base Approver
    The King of Overkill! VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Perfect!! Just what I was looking for, thanks Steiner!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •