Consulting

Results 1 to 3 of 3

Thread: How to use MouseDown

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    How to use MouseDown

    I have a Word .dotm test form through which I Tab to successive form fields and fill them out before Tabbing to the next field. I have VBA code I execute on Exit of each field to check tolerances of the numbers entered in each field. However, I want to be able to stop filling out the form and go to some other place in the document by scrolling somewhere far away and clicking there. For example, I might wish to only do a partial test then go back to the top of the document where I mark the test pass or fail. However, if I click far away, I'm dragged back to the last field where I left off to display that I failed the tolerance of that field because I left the procedure before finishing all the fields of the test.

    So I'd like to detect when I go to some far away field by using the mouse button verses when I use the Tab button to go to the the next field in the usual procedure. I think the only way to detect a premature departure of the normal sequence is to detect a LEFT mouse button by using the MouseDown function in VBA. I'm hoping that this function will execute before I run macro on exit of the field where I left off before I clicked far away. Then the MouseDown code can set a variable that disables the Out of Tolerance message box from displaying. Then I can use the Mouse to prematurely exit the testing procedure and go anywhere I like without being dragged back to the last field not yet filled out.

    But I don't know the details of using the MouseDown function. Can anyone here offer any help? I'm not sure I need to create Class modules and event_handlers, etc. Any help is appreciated. Thank you.
    Last edited by Mike Express; 01-18-2020 at 01:31 PM.

Posting Permissions

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