Inter-program communication using SendKeys

  • Thread starter Thread starter Tim Coddington
  • Start date Start date
T

Tim Coddington

Trying to figure out how to manipulate an instance of explorer from VBA.
Tried the following, but get a

"Run-time error '5':
Invalid proceedure call or argument"

on the AppActivate line.


Sub TryIt()
Dim ieAlphaTrade, ieAmeritrade As Double

ieAlphaTrade = Shell("C:\Program Files\Internet Explorer\iexplore.exe",
vbNormalFocus)
AppActivate ieAlphaTrade, True
End Sub

Tried a DoEvents before the AppActivate, and that seemed to help a little,
but the error came back.

Any hints?

Thanks in advance,
-Tim
 
In case you still want to use the sendkeys functions (I agree tha
controlling IE from excell is better), here's how I avoided the error:

Sub TryIt()
Dim ieAlphaTrade, ieAmeritrade As Double

ieAlphaTrade = Shell("C:\Program Files\Internet Explorer\iexplore.exe"
vbNormalFocus)
On Error Resume Next
Do
Err.Clear
AppActivate ieAlphaTrade, True
Loop Until Err.Number = 0
End Sub
 

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

Back
Top