View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chris Chris is offline
external usenet poster
 
Posts: 1
Default Close External Apps Issue

I coded this macro to close two external applications when activated.
The macro was working perfectly fine before but now it fails to send
the SendKeys properly and neither application closes. I don't know if
it is an issue with the coding or due to computer related issues.

The code I used is:

Sub CloseApp()
AppActivate "X"
SendKeys "%{F4}"
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "~"
Application.Wait (Now + TimeValue("0:00:05"))
AppActivate "Y"
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "%{F4}"
End Sub

Substituted "X" and "Y" for the actual app names.

Thanks for your help in advance.