Consulting

Results 1 to 4 of 4

Thread: After RightClick, stop menu appearing

  1. #1

    After RightClick, stop menu appearing

    Hi All,

    I have a little bit of code that shows a userform as part of the BeforeRightClick event.

    Once I have finished with the userform and hide it, is there a way to stop the Right-Click menu showing ?

    Thanks
    captHedge

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    Create a public variable and set it to false on closing the form, and test it in the event code.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    [VBA]
    Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    MsgBox "No Right-Clicking!", vbOKOnly + vbInformation, "My Excel Events"
    Cancel = True
    End Sub
    [/VBA]you can put the two lines (msgbox optional) at the end of the code in the module!
    Regards,
    BG.

  4. #4
    Thanks for that...

    In the end, all I did was add this to the event

    [VBA]cancel = TRUE[/VBA]

    before I called the userform and viola, the standard menu was cancelled at the end.

    Thanks again

Posting Permissions

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