NumLock turns off with SendKeys statement?

B

beeawwb

Does anybody have any idea why my numlock keeps turning off after ever
sendkeys statement? I can't get it to turn on with SendKeys({NumLock}
either.

Really stumping me, as it usually works fine. I use SendKeys in man
other applications, it's only Excel that is causing me problems... An
ideas what to do / might be causing this?

Thanks for your help.

-Bo
 
V

Vasant Nanavati

Hard to tell without seeing your specific code, but the use of SendKeys is
rarely advisable and should be employed only as a last resort.
 
B

beeawwb

My code follows.

Sub AppGIS()

Dim CellValue
Dim CMValue
Dim CMClaim
Dim compareme

'Define ClaimNumber
CellValue = Selection.Cells.Value

'Check for CM Claim
compareme = CellValue Like "????????/?"
If compareme = True Then GoTo CM

'Check for Payment Number
compareme = CellValue Like "#######"
If compareme = True Then GoTo Payment

'If Not CM or Payment, is DM
GoTo DM

'Set Commercial Claim format
CM:
CMValue = Left(CellValue, 8)
CMClaim = Right(CellValue, 1)

'Switch to GIS
AppActivate ("Host4 - EXTRA! for SNA Server")
SendKeys ("CM.QCL{ENTER}")
'Wait 2 Seconds
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 2
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
'Enter Claim number into GIS
SendKeys ("{TAB}" & CMValue & "{TAB}" & CMClaim)
SendKeys ("{ENTER}")

GoTo EndMe

DM:
'Switch to GIS
AppActivate ("Host4 - EXTRA! for SNA Server")
SendKeys ("DM.QCL{ENTER}")
'Wait 2 Seconds
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 2
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
'Clear Claim and Enter DM Claim Number into GIS
SendKeys ("{TAB} {TAB}{TAB}" & CellValue)
SendKeys ("{ENTER}")
GoTo EndMe

Payment:
'Alert payment
MsgBox ("This Reference Number is a Payment. Please query Manually")
'Switch To GIS
AppActivate ("Host4 - EXTRA! for SNA Server")

EndMe:
'Completed Successfully.
Beep
End Sub


Thanks for your help.

-Bo
 
B

beeawwb

Ahhh, the Microsoft Help worked perfectly. That's kind of weird with th
double sendkeys. It was happening when I put the {ENTER} on a secon
line (throwback to GIS Visual Basic, where the Enter had to be on
second line or it would error out.).

I put a DoEvents between the multiple sendkeys, and it works fine.

As for Google Groups, I can't access that from my work terminal. But
can access this newsgroup. Go figure. O_o

Thanks once again.

-Bo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top