PDA

View Full Version : Solved: Same Excel Constants Have Different Names??



Cyberdude
10-22-2005, 01:10 PM
For the following I have always used the constants as shown:

Application.Calculation........ xlManual, xlAutomatic
.HorizontalAlignment.......... xlCenter, xlLeft
.VerticalAlignment.............. xlCenter, xlBottom

But I?ve noticed that in Help they show expanded names like:

xlCalculationManual, xlCalculationAutomatic
xlHAlignCenter, xlHAlignLeft, etc.
xlVAlignCenter, xlVAlignBottom, etc.

It isn?t clear to me what the difference is (if any) or why they?ve changed the names.
Is there any danger in continuing to use the shortened names?

Norie
10-22-2005, 01:13 PM
I don't think so.

What the constant is named is really sort of irrelavant, it just helpful.

You could actually just replace the constants with the appropriate integer value.

TonyJollans
10-22-2005, 01:32 PM
I don't think there's any real danger in practice - but in theory xlAutomatic, say, could be given a new numeric value in a new release of Excel so that it would no longer be the same as xlCalculationAutomatic. It's good practice to use the 'correct' constants but I wouldn't lose any sleep over it.

Cyberdude
10-22-2005, 01:35 PM
I assume from what you say that all the similar constants have the same numeric value. I tested some of them and they were indeed the same. I guess I just got the feeling that there must have been a reason for the change, and I couldn't help but wonder what it was and if it might have an impact on older code.

Ivan F Moala
10-22-2005, 03:46 PM
Microsoft has maintained the Constants so that all similar names have the same constant value BUT refer to different Constant groups eg.
http://www.xcelfiles.com/Const1.JPG

The above is the group constants for Xlcalculation note the [Automatic]

Now for the same constant values -4105
See below right image

http://www.xcelfiles.com/Const.JPG

See above left.
MS has maintained the same value even though they belong to different groups. Although I have found no real conflicting ones
I would still stick to the Actual Const given for THAT GROUP, just in case. You can do this via having the intellisence turned on.

Cyberdude
10-23-2005, 10:16 AM
Thanks, Gang! I think you are right about starting to use the newest versions.