+ Reply to Thread
Results 1 to 2 of 2

how to declare Pub Const String Array ?

  1. #1
    dick
    Guest

    how to declare Pub Const String Array ?

    can someone please show me how to declare a Public Constant String
    Array? With shortened spelling below:

    Pub Const C as String = "jones" works OK
    Pub Const C(2) as String = "jones","smith" does not work

    What to do? I would like to be able to index in an array of strings to
    get replacement values for stuff in columns H,I,J etc. by using an
    index of 18,19,20 etc.

    Thanks


  2. #2
    Tom Ogilvy
    Guest

    Re: how to declare Pub Const String Array ?

    An array isn't a constant and can't be initialized as a constant, so you
    will just have to initialize the variable.

    Dim C as Variant
    C = Array("Jones","Smith")

    or
    Dim C(1 to 2) as String
    C(1) = "Jones"
    C(2) = "Smith"

    You can make your declarations public at the top of the module outside any
    procedure and use a procedure to initialize them. Then, unless you reset
    the VBE, you should be able to treat them like constants.
    --
    Regards,
    Tom Ogilvy


    "****" <[email protected]> wrote in message
    news:[email protected]...
    > can someone please show me how to declare a Public Constant String
    > Array? With shortened spelling below:
    >
    > Pub Const C as String = "jones" works OK
    > Pub Const C(2) as String = "jones","smith" does not work
    >
    > What to do? I would like to be able to index in an array of strings to
    > get replacement values for stuff in columns H,I,J etc. by using an
    > index of 18,19,20 etc.
    >
    > Thanks
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1