Results 1 to 10 of 10
  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Right clicks & double-clicks

    On a sheet named "Start", I have set the scroll area to limit the user to a specified range. But the user could still cause damage by double-clicking outside the scroll area!

    Is there a procedure that will intercept a double-click and present a MsgBox with an [OK] that will return to the present screen. If that's possible, perhaps I could prevent the user from right-clicking as well??
    - Ricky

  2. #2
    ScoobyDoo!
    Guest

    Re: Right clicks & double-clicks

    Ricky,

    Yes, you can stop the mouse event from firing by capturing the MouseDown event using VBA. You'd have to play with it a bit, but if you are reasonable comfy with VBA, you could certainly pull it off with style and grace. If you're using Excel 2000, look in the Help file under Programming information, and then Events. Find the one for MouseDown. That should give you a decent headstart.

    Happy Weekend!

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Right clicks & double-clicks

    Hey Scooby - I know it's just me but the MS help files presents more questions than it answers... I normally tinker with something like this for an hour before I post for assistance. I'm checking a reference guide on VBA that I downloaded - maybe there's something there.

    The latest accomplishment of my tinkering is that I can now produce a run-time error by blinking! <img src=/S/yikes.gif border=0 alt=yikes width=15 height=15>
    - Ricky

  4. #4
    ScoobyDoo!
    Guest

    Re: Right clicks & double-clicks

    Well, Ricky,
    If you send it to shakespearestwistedbro@hotmail.com, I would be willing to take a wack at making it work for you. No promises, of course, but it sounds like an interesting challenge.

  5. #5
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Right clicks & double-clicks

    Yo Scoob!

    I've attached an example sheet that only has the code to activate a sheet and set the scroll area. There's a note next to the scroll area that explains what I'm trying to achieve - just as I've explained in my earlier post. I'd appreciate any help you could offer.
    Attached Files Attached Files
    - Ricky

  6. #6
    ScoobyDoo!
    Guest

    Re: Right clicks & double-clicks

    I'll play with it this evening. Give me a couple of hours. I'll let you know if I give up on it.

    Happy Weekend!
    Matt

  7. #7
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Right clicks & double-clicks

    Okay - I've figured out the routines for sending the msgbox to the screen in either event (right Click & double Click). Next on my list: Is there a way that I can manipulate the placement (on the screen) of the message box?
    - Ricky

  8. #8
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Right clicks & double-clicks

    Ricky,

    Consider the need for any message at all. Can you just cancel Right and Double clicking for that particular sheet with

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
    End Sub

    Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
    End Sub

    Just enter the above code in the worksheet codepane and such clicks should cause no problem. If you want to disable those clicks for all worksheets use Workbook_SheetBeforeRightClick instead of Worksheet_BeforeRightClick and place the code in the ThisWorkbook codepane.

    As righclick is a just a shorcut to certain operations, those operations are not disabled and can be accessed through normal menus, toolbars and shortcut keystrokes. Maybe you should consider cell protection and data validation as methods to protect data.

    Andrew

  9. #9
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Right clicks & double-clicks

    No, you can't control the placement of the message box. To control the placement, you would have to use a User Form instead of a Msgbox.
    Legare Coleman

  10. #10
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Right clicks & double-clicks

    As you have summized, the real goal was to help the user from making a critical mistake. And to protect the integrity of the sheet, which double-clicking would have penetrated. Right-clicking gives the user a 'delete' option.

    Cancel=True - was the solution I needed. No MsgBox necessary. Thank you
    - Ricky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •