declaring Excel constants

R

RB Smissaert

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
 
B

Bob Phillips

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)
 
R

RB Smissaert

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
 
C

Chip Pearson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top