Good computer science concepts discussion. @The_Doc_Man explains it well -- addition works in this case only because the bit patterns don't overlap. But, if you mistakenly add the same constant value more than one time, addition would corrupt the bitwise representation but using bitwise OR would work fine. For example:
if you mistakenly added vbYesNo twice, you would get unexpected results:
response = MsgBox("Print Customer Receipt?", vbYesNo + vbDefaultButton2 + vbYesNo)
but if you made the same mistake but used OR, this would still work (you would get your YesNo buttons with No button as the default):
response = MsgBox("Print Customer Receipt?", vbYesNo Or vbDefaultButton2 Or vbYesNo)
With that said, I do use the addition representation for MsgBox'es as it does work fine as long as you don't repeat any values.
if you mistakenly added vbYesNo twice, you would get unexpected results:
response = MsgBox("Print Customer Receipt?", vbYesNo + vbDefaultButton2 + vbYesNo)
but if you made the same mistake but used OR, this would still work (you would get your YesNo buttons with No button as the default):
response = MsgBox("Print Customer Receipt?", vbYesNo Or vbDefaultButton2 Or vbYesNo)
With that said, I do use the addition representation for MsgBox'es as it does work fine as long as you don't repeat any values.