+ Reply to Thread
Results 1 to 4 of 4

Keybd_event Problem VBA

  1. #1
    Registered User
    Join Date
    04-08-2014
    Location
    france
    MS-Off Ver
    Excel 2007
    Posts
    1

    Keybd_event Problem VBA

    Hello !

    Here's my problem :

    Please Login or Register  to view this content.
    With those 4 lines of code, i want to simulate the Shift+Pause combination, and it works.
    But the problem is, after that, the Shift key is still press, and it causes me a lot of trouble.

    I tried SendKeys, but they didn't work for that combination of keys.

    Thank you.

    A.

    PS : I had the same problem with a Ctrl + V, with the Ctrl Key.

  2. #2
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Keybd_event Problem VBA

    Welcome to the forums. What is it that you are trying to accomplish because instead of the pause you might be able to tell the macro to wait for a specific amount of time long enough for you to do something and then it will continue rather than you having to pause it. Also if you are having trouble because you don't have a break key try this. If that is too annoying or to long again you can tell the macro to wait. Let me know.

    http://social.msdn.microsoft.com/For...terrupting-vba
    "CTRL-BREAK does work on Windows 7 and Windows 8 and on all versions of Excel including 2013. However, if you don't have "DoEvents" in your loop it will not work, since the break signal is never processed.For all loops, put a "DoEvents" in your loop. Also, save your work before running new code! BTW, for a computer without a BREAK key, press the start button, type "On" and choose "On-Screen Keyboard". When the keyboard appears you can click CTRL then click "PAUSE" (which is the same as BREAK).

    Saturday, August 17, 2013 9:39 PM

    BY: "ChaosFreak"
    "
    Thank those who have helped you by clicking the Star * below their name and please mark your post [SOLVED] if it has been answered satisfactorily.

  3. #3
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: Keybd_event Problem VBA

    Did this help?

  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,258

    Re: Keybd_event Problem VBA

    Hello little75,

    From the symptoms you describe, I suspect that your constant KEYEVENTF_KEYUP is not equal to 2. Did you declare the constant locally within the procedure or globally in a VBA Module?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to send "A" with keybd_event?
    By keymuu in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-05-2014, 08:31 AM
  2. input box problem, cell filtering problem, result display while locking sheet
    By croozin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2013, 08:52 AM
  3. Can't send specific LEFT or RIGHT Ctrl- or Alt-key with keybd_event ?
    By onidarbe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-02-2013, 09:51 AM
  4. Replies: 6
    Last Post: 05-28-2013, 05:08 PM
  5. more keys on keybd_event
    By ilkamalo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-23-2012, 08:14 AM

Tags for this Thread

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