+ Reply to Thread
Results 1 to 6 of 6

An equivalent to SendKeys but for a mouse-click?

  1. #1
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241

    An equivalent to SendKeys but for a mouse-click?

    I have a UserForm floating, always visible, on my screen.
    When I call a macro, at the end of the operation the keyboard remains dead until I mouse-click somewhere: I cannot type on the cell where the cursor has ended if I don’t click on it first.
    I’ve tried ending the macros with ActiveCell.Select, with Application.SendKeys=“ENTER” etc. to no avail.

    But if I could end them with a command equivalent to a mouse-click, that might solve the problem. Is there something like SendKeys but for the main button of the mouse?

    With my sincere thanks for your coming help and, even more so, for your help in the past,
    ACA

  2. #2
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241
    By trial and error I’ve found an answer to my own query. I don’t know if it’s against the forum rules to reply to oneself, but 13 people looked at my question though they did not answer; they may have the same problem. So I thought I would post my finding for their benefit, perhaps.

    One solution, then, is the Application.Interactive command. Insert it twice in the macros: first with the value = False and, at the end, =True.
    That seems to deactivate the UserForm on the screen and free the keyboard operation.
    ACA

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    I don’t know if it’s against the forum rules to reply to oneself, ...
    Not at all, and it's thoughtful of you to do so.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello aca,

    Just an after thought. Did you consider showing the form as non modal? You would then be able to interact with the application and the user form.

    Sincerely,
    Leith Ross

  5. #5
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241
    Hello, Leith.

    Yes, my UserForm was non-Modal from the start, of course. Without that, nothing at all, and never, could be done on the screen once the UserForm appeared, not even with the mouse.
    But, to my unpleasant surprise, even been non-Modal, the keyboard (only) became dead and only following the execution of the macros: the UserForm remained active, its frame brightly lit, and the keyboard non-active, (the mouse active, though); until finally I hit upon that solution of Application.Interactive false and true; with that, after the macro execution, the frame of the UserForm fades (deactivated) and the keyboard gets restored.

    So long, and thanks.
    ACA

  6. #6
    Forum Contributor
    Join Date
    07-01-2008
    Location
    Cincinnati, OH
    Posts
    150
    Nice tip, ACA. I have always had to resort to using API commands. Does anyone know what version this method came into being?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1