ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SENDKEYS change the "Number Lock" status (https://www.excelbanter.com/excel-programming/299177-sendkeys-change-number-lock-status.html)

Kenneth Lam

SENDKEYS change the "Number Lock" status
 

Hi,

I am using sendkeys to enter data into Peachtree. I found that after
Excel changed to Peachtree and start entering, the number lock
"sometimes" will on and off for several times.

I have tried to write a "plain" macro with "sendkeys" only and test on
other software and found it is the same. The status will also change.
The pattern is not fixed. That is under the same problem and same
string being sent, sometimes will flash 2 times and sometimes may
flash 5 times.

Any suggestions?

Thanks.
---
Please remove NOSPAM- in the email address when replying by email.

Dave Peterson[_3_]

SENDKEYS change the "Number Lock" status
 
Option Explicit
Declare Function SetKeyboardState Lib "User32" (kbArray As Byte) As Long
Sub toggleit()
Dim KeyState(0 To 255) As Byte
KeyState(&H90) = 1 'for on 0 for off
SetKeyboardState KeyState(0)
End Sub

Worked ok for me in win98.


Kenneth Lam wrote:

Hi,

I am using sendkeys to enter data into Peachtree. I found that after
Excel changed to Peachtree and start entering, the number lock
"sometimes" will on and off for several times.

I have tried to write a "plain" macro with "sendkeys" only and test on
other software and found it is the same. The status will also change.
The pattern is not fixed. That is under the same problem and same
string being sent, sometimes will flash 2 times and sometimes may
flash 5 times.

Any suggestions?

Thanks.
---
Please remove NOSPAM- in the email address when replying by email.


--

Dave Peterson



All times are GMT +1. The time now is 08:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com