Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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" wrote in message
...
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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Constants in Excel Sharon Excel Discussion (Misc queries) 0 July 24th 08 02:38 PM
vba constants for excel diver Excel Discussion (Misc queries) 2 August 25th 05 07:51 PM
Declaring Constants that can be used throughout the Workbook :) eXcellence Excel Programming 4 June 30th 05 01:47 AM
Declaring array constants at module level Microsoft Forum Excel Programming 2 January 24th 05 06:31 PM
declaring constants from the sheet? robert burger Excel Programming 4 August 25th 04 06:47 PM


All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"