+ Reply to Thread
Results 1 to 4 of 4

declaring Excel constants

  1. #1
    RB Smissaert
    Guest

    declaring Excel constants

    For a VB6 ActiveX dll I had to declare some xl Constants.
    Does it matter which of the following 3 ways you choose?

    Const xlUp as long = -4162
    Const xlUp as Integer = -4162
    Const xlUp = -4162

    It looks the datatype is Integer but I am not sure.

    RBS

  2. #2
    Bob Phillips
    Guest

    Re: declaring Excel constants

    It doesn't matter, but declaring as Long is the most efficient. Integers
    could cause a problem if you try and load a too large value in them. Long is
    safe and fully typed.

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "RB Smissaert" <bartsmissaert@blueyonder.co.uk> wrote in message
    news:eP0tXn8QGHA.1416@TK2MSFTNGP12.phx.gbl...
    > For a VB6 ActiveX dll I had to declare some xl Constants.
    > Does it matter which of the following 3 ways you choose?
    >
    > Const xlUp as long = -4162
    > Const xlUp as Integer = -4162
    > Const xlUp = -4162
    >
    > It looks the datatype is Integer but I am not sure.
    >
    > RBS




  3. #3
    RB Smissaert
    Guest

    Re: declaring Excel constants

    OK, I thought that was the best option but thanks for making it clear.
    Just one thing there is the file XL97CONS.BAS on one of the MS sites
    and that doesn't set the datatype. Any idea why that is?

    RBS

    "Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in message
    news:OiMRZx8QGHA.5584@TK2MSFTNGP12.phx.gbl...
    > It doesn't matter, but declaring as Long is the most efficient. Integers
    > could cause a problem if you try and load a too large value in them. Long
    > is
    > safe and fully typed.
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from email address if mailing direct)
    >
    > "RB Smissaert" <bartsmissaert@blueyonder.co.uk> wrote in message
    > news:eP0tXn8QGHA.1416@TK2MSFTNGP12.phx.gbl...
    >> For a VB6 ActiveX dll I had to declare some xl Constants.
    >> Does it matter which of the following 3 ways you choose?
    >>
    >> Const xlUp as long = -4162
    >> Const xlUp as Integer = -4162
    >> Const xlUp = -4162
    >>
    >> It looks the datatype is Integer but I am not sure.
    >>
    >> RBS

    >
    >



  4. #4
    Chip Pearson
    Guest

    Re: declaring Excel constants

    All the Excel constants are declared as Longs (Enums) in the
    Excel typelib, so go with As Long.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "RB Smissaert" <bartsmissaert@blueyonder.co.uk> wrote in message
    news:eP0tXn8QGHA.1416@TK2MSFTNGP12.phx.gbl...
    > For a VB6 ActiveX dll I had to declare some xl Constants.
    > Does it matter which of the following 3 ways you choose?
    >
    > Const xlUp as long = -4162
    > Const xlUp as Integer = -4162
    > Const xlUp = -4162
    >
    > It looks the datatype is Integer but I am not sure.
    >
    > RBS




+ 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