If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Keyboard/Mouse click event

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-20-05, 20:12
bhavesh78 bhavesh78 is offline
Registered User
 
Join Date: Dec 2004
Posts: 78
Question 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
Reply With Quote
  #2 (permalink)  
Old 01-25-05, 11:11
DavidCoutts DavidCoutts is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 01-26-05, 11:12
bhavesh78 bhavesh78 is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On