Tuesday, April 17, 2007

Disable Right Click

You can use the following function to disable mouse click. Right Click

This will disable popup menu

Sub Disable_Right_Click()

' ---------------------------------------------------------------
' Written By Shanmuga Sundara Raman for http://vbadud.blogspot.com
' ---------------------------------------------------------------

' This will disable mouse right click on worksheets

Application.CommandBars("Cell").Enabled = False

End Sub


D

2 comments:

  1. this is not working on my excl sheet

    ReplyDelete
  2. Anonymous1:52 AM

    Thanks a lot for your suggestion. Now, I could also disable row and column now, here is the code :

    Private Sub worksheet_activate()
    Application.CommandBars("Row").Enabled = False
    Application.CommandBars("Column").Enabled = False
    Application.CommandBars("Cell").Enabled = False
    End Sub

    Private Sub worksheet_deactivate()
    Application.CommandBars("Row").Enabled = True
    Application.CommandBars("Column").Enabled = True
    Application.CommandBars("Cell").Enabled = True
    End Sub

    Regards,
    Suyadi
    oji1997@yahoo.com

    ReplyDelete

StumbleUpon
Share on Facebook
Related Posts Plugin for WordPress, Blogger...

Visual Basic for Applications (VBA) Forum (recent threads)

CodeKeep VBA Feed

Visual Studio Tools for Office Forum (recent threads)

Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.

Office Business Applications (OBA) Team Blog

MSDN Code Gallery Published Resources For Tag VSTO

microsoft.public.vsnet.vstools.office Google Group