View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Mark is offline
external usenet poster
 
Posts: 989
Default troubles with SendKeys

Hello,

I've been having trouble getting SendKeys to act as I would like.

The thing I started to work on is to load data to another application, but I
simplified it down to this, and it still stops:

****************
For i = 1 To 6 Step 1

AppActivate "Untitled - Notepad", True
DoEvents
sendkeys "123456{ENTER}"
DoEvents

Next i
************

When I run that, it starts Notepad, but doesn't enter anything. The code
doesn't stop though... each time that I click on the Excel application
window, or on the VBA code window, if I'm running it that way, it cycles one
more loop through the code, entering the data into Notepad, as it should.

But it only ever does one iteration of the loop at a time, waiting for me to
click on the application window again before it continues.

Ideas as to why?

Thanks,
Mark