Deny Access To 'right-click' Attributes

  • Hi,


    Are the 2 examples the correct methods to prevent right-click on Rows and Columns?


    'Prevent Right Click on entire selected Row(s)

    Code
    Application.CommandBars("Row").Enabled = False


    'Prevent Right Click on entire selected Column(s)

    Code
    Application.CommandBars("Column").Enabled = False


    Thanks in advance,

  • Re: Deny Access To 'right-click' Attributes


    Hi DerbyNeal,


    Can you please tell me the original 2 command bars in your post?


    I have used the code in the post and you have removed it since then. I now cannot access the right click events for those bars.


    Bill

  • Re: Deny Access To 'right-click' Attributes


    Ranger,


    Are you saying that you have lost the ability to do this now, after you ran the code once?


    If so then try running


    Code
    Application.CommandBars("Column").Reset
    Application.CommandBars("Rows").Reset


    Hopefully that'll give you them back.


    Of course, I may have totally misunderstood you, in which case I apologise for wasting your time! ;)


    KJ

  • Re: Deny Access To 'right-click' Attributes


    Hi KJ,


    Thanks for the reply. Those were not the two original statements on the post. They were edited, but I had used the code and my machine crashed shortly afterwards (not because of the code) and I had not saved the file. I just need the original code before the post was edited.


    Bill

  • Re: Deny Access To 'right-click' Attributes


    All yout Toolbar setting are stored in a special file (.xlb), unfortunately this has probably been lost or amended because of the crash. The best thing to do for future reference is to locate that .xlb and creat a backup. Mine is in


    C:\Documents and Settings\Roy Cox\Application Data\Microsoft\Excel


    You can try this to restore them


    Code
    Sub Restore() 
    Dim a As Integer 
    On Error Resume Next 
    With Application.CommandBars 
        .Item(1).Enabled = True 
        For a = 2 To Application.CommandBars.Count 
            .Item(a).Visible = Status(a) 
        Next a 
    End With 
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!