Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004
    Posts
    78

    Question Unanswered: Keyboard/Mouse click event

    Can I write an event/procedure so that when user hits a key on keyboard or clicks any mouse key a message is displayed?

    Thanks.

    ~BS

  2. #2
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    Code:
    Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
        Cancel = True
        Call msgboxtest
    End Sub
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        Call msgboxtest
    End Sub
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        Call msgboxtest
    End Sub
    
    Sub msgboxtest()
        MsgBox "message"
        End
    End Sub
    Heres a start to this
    you could also look at application.onkey

    HTH
    Dave

  3. #3
    Join Date
    Dec 2004
    Posts
    78
    This one works. Also the following code makes the 'Save As' disabled in excel for all open workbooks. Is there a way to disable Save as only on one workbook.

    Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save As...").Enabled = False

    Thanks.

    ~BS

Posting Permissions

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