View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bill Manville Bill Manville is offline
external usenet poster
 
Posts: 473
Default AppActivate trouble...

David Kay wrote:
I was using AppActivate with the Sendkeys statement with
great success on my old workstation (P2-366Mhz with NT) in
a workbook I use all day to communicate with a program
running in the background. Today I got a new workstation
(P4-2Ghz with XP), loaded the workbook and the macro
doesn't work as well.


Maybe a timing problem of some sort.

You may need to insert a DoEvents before the SendKeys to give the
AppActivate a chance to work - otherwise the keys may be being
swallowed by something else.

You may even need to insert a delay.

Here's a procedure to sleep for a while:

' at the top of your module
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

' in your code
Sleep 500 ' wait half a second

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup