View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default SendKeys problem

Try using the True parameter at the end of the statement, e.g.:
AppActivate "Microsoft Excel", True
AppActivate "OtherApp", True
(this forces VBA to wait until the calling app (your VBA routine in Excel)
has the focus back before it activates the next one - sometimes the timing
makes a difference on whether the app is ready to be activated yet. In
practice I have found I need to figure this out by trial and error.
--
- K Dales


"Zakynthos" wrote:

I'm using SendKeys to access various parts of a company intranet, input
usernames/passwords, move through various menus etc.

Each subroutine works fine in itself but when I try to run them all
together, I keep getting errors at the "AppActivate .....(2nd window)". But
when run separately, this (second) macro works quite OK.

I've tried to solve the problem by using:

Appactivate "Microsoft Excel"

at the end of the first subroutine in order to 'return' to the Excel window,
but this doesn't seem to work either.

What's causing the problem and how do I solve it?