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
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
Hi,
You could. Is there some reason you can't write code for the form's mouse-up mouse-down and keypress procedures?
Leith Ross
I am new to VBA, so dont have much experience with mouse click events... would appreciate if you can give some example for mouse click events and where to place them.
Thanks.
Bhavesh
Hello Bahvesh,
VBA is an event driven language. All objects have properties, methods, and events. Keyboard input and mouse movement are two very common system events. VBA Edit controls like TextBox, ComboBox, and ListBox respond to both. However, Static controls like a Label only respond to Mouse Events.
It would help me to help you if you gave me an outline of what you want to accomplish. Once I understand what you want to do, I can show you examples of code to solve your problem. Think it over and re-post your programming objectives.
Thanks,
Leith Ross
Hello Leith,
I am using the following on many of my worksheets to enable/disable copy paste.
http://xcelfiles.homestead.com/VBA_Quick13.html
The problem with this code is that, when I open two workbooks simultaneously, with cut/copy disabled on both using worksheet_open, and then close one of the workbook (here I reset cut/copy and enable it again in workbook_beforeclose event), then it enables it on other workbook also.
By using mouse click event, i want to run the disable macro again so that cut/copy remains disabled on other worksheet even if one worksheet is closed.
Another option would be to figure out a way to disable cut/copy only on a particular worksheet, instead of disabling it for excel. In this code, if a worksheet is opened with cut/copy disabled, it disables it for excel as whole and does not allow cut/copy on a blank new worksheet also.
I hope I was able to convey the problem.
Thanks.
Bhavesh
Try running the script on Workbook_Activate / Workbook_Deactivate instead of Open/BeforeClose.
That should serve your purposes.
It works. Don't know why I did not try this earlier.
Thanks.
Bhavesh
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks