Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Inter-program communication using SendKeys

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Inter-program communication using SendKeys

Hi Tim,
IE takes time to open and load the page. Shell just dumps to the command prompt so you need to find a way to wait for IE fully open before sending sendkey commands.

A better method is to control IE from within your VBA code.
There is some info here that should get you started.
http://www.google.com/groups?hl=en&l...6btnG%3DSearch


--

John
johnf202 at hotmail dot com


"Tim Coddington" wrote in message ...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inter-program communication using SendKeys


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



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26634

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Inter-program communication using SendKeys

You guys are GREAT. Thanks! This will get me started.
"kkknie" wrote in message
...

In case you still want to use the sendkeys functions (I agree that
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

K


--
kkknie
------------------------------------------------------------------------
kkknie's Profile:

http://www.excelforum.com/member.php...fo&userid=7543
View this thread: http://www.excelforum.com/showthread...hreadid=266344



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
communication with MS Project Anne[_4_] Excel Programming 1 September 23rd 04 12:50 PM
communication daniel Excel Programming 2 April 16th 04 12:01 PM
communication Daniel[_8_] Excel Programming 0 April 2nd 04 09:46 AM
communication Rob van Gelder[_4_] Excel Programming 1 April 1st 04 01:06 PM
SendKeys command not focusing on the correct open program mjwillyone[_12_] Excel Programming 0 December 30th 03 04:06 AM


All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"