acShiftMask is included in the VBA Help topics for MouseUp
and MouseDown Event.
Hmmm. I'm not able to find that here. I did find this:
*****
MouseDown, MouseUp Events
Occur when the user clicks a mouse button. MouseDown occurs
when the user presses the mouse button; MouseUp occurs when
the user releases the mouse button.
Syntax
For MultiPage, TabStrip
Private Sub object_MouseDown( index As Long, ByVal Button As
fmButton, ByVal Shift As fmShiftState, ByVal X As Single,
ByVal Y As Single)
Private Sub object_MouseUp( index As Long, ByVal Button As
fmButton, ByVal Shift As fmShiftState, ByVal X As Single,
ByVal Y As Single)
For other controls
Private Sub object_MouseDown( ByVal Button As fmButton,
ByVal Shift As fmShiftState, ByVal X As Single, ByVal Y As
Single)
Private Sub object_MouseUp( ByVal Button As fmButton, ByVal
Shift As fmShiftState, ByVal X As Single, ByVal Y As Single)
The MouseDown and MouseUp event syntaxes have these parts:
Part Description
object Required. A valid object.
index Required. The index of the page or tab in a
MultiPage or TabStrip with the specified event.
Button Required. An integer value that identifies which
mouse button caused the event.
Shift Required. The state of SHIFT, CTRL, and ALT.
X, Y Required. The horizontal or vertical position, in
points, from the left or top edge of the form, Frame, or
Page.
Settings
The settings for Button are:
Constant Value Description
fmButtonLeft 1 The left button was pressed.
fmButtonRight 2 The right button was pressed.
fmButtonMiddle 4 The middle button was pressed.
The settings for Shift are:
Value Description
1 SHIFT was pressed.
2 CTRL was pressed.
3 SHIFT and CTRL were pressed.
4 ALT was pressed.
5 ALT and SHIFT were pressed.
6 ALT and CTRL were pressed.
7 ALT, SHIFT, and CTRL were pressed.
You can identify individual keyboard modifiers by using the
following constants:
Constant Value Description
fmShiftMask 1 Mask to detect SHIFT.
fmCtrlMask 2 Mask to detect CTRL.
fmAltMask 4 Mask to detect ALT.
Remarks
For a MultiPage, the MouseDown event occurs when the user
presses a mouse button over the control.
For a TabStrip, the index argument identifies the tab where
the user clicked. An index of -1 indicates the user did not
click a tab. For example, if there are no tabs in the upper
right corner of the control, clicking in the upper right
corner sets the index to -1.
For a form, the user can generate MouseDown and MouseUp
events by pressing and releasing a mouse button in a blank
area, record selector, or scroll bar on the form.
The sequence of mouse-related events is:
1. MouseDown
2. MouseUp
3. Click
4. DblClick
5. MouseUp
MouseDown or MouseUp event procedures specify actions that
occur when a mouse button is pressed or released. MouseDown
and MouseUp events enable you to distinguish between the
left, right, and middle mouse buttons. You can also write
code for mouse-keyboard combinations that use the SHIFT,
CTRL, and ALT keyboard modifiers.
If a mouse button is pressed while the pointer is over a
form or control, that object "captures" the mouse and
receives all mouse events up to and including the last
MouseUp event. This implies that the X, Y mouse-pointer
coordinates returned by a mouse event may not always be
within the boundaries of the object that receives them.
If mouse buttons are pressed in succession, the object that
captures the mouse receives all successive mouse events
until all buttons are released.
Use the Shift argument to identify the state of SHIFT, CTRL,
and ALT when the MouseDown or MouseUp event occurred. For
example, if both CTRL and ALT are pressed, the value of
Shift is 6.
*****
....but no mention of "acShiftMask" that I could find.
Are you sure you are using one of those events? If you put
that code in the Click event, you should have received a
compile error about Shift being an undefined variable (if
you didn't get a compile error, you are missing the
Option Explicit
statement at the top of the module).
Just to be sure, I remade the module, and got the same
results. I made sure to put it on the MouseDown event.
Perhaps this function(?) was added after v2002?
Maybe I should switch to a keypress or keydown event--I've
gotten those to work before. I'll just have to find where
I've done it and try to understand what I did!
I had no idea it would be so difficult to do a Shift-Click!
Thanks for your suggestions.