Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default simulate pressing enter not working

hi,

i have the following. it basically puts the focus on the IE window. but im
trying to take it a step further by simulating hitting the ENTER key in the
IE window. i manually tested hitting ENTER in the IE window and it does what
i want but for some reason it does not work programmatically...

If lHwnd < 0 Then
ShowWindow lHwnd, SW_SHOWNORMAL
Dim XT As Long
XT = BringWindowToTop(lHwnd) 'brings the IE window to top
Windows.Application.SendKeys "{ENTER}"
SendKeys "{ENTER}"

thanks in advance,
geebee

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default simulate pressing enter not working

GeeBee,
You've inadvertently posted to the Excel forum. You might want to try
again in the IE forum. Sorry we can't help.
Sincerely,
Gary Brown


"geebee" wrote:

hi,

i have the following. it basically puts the focus on the IE window. but im
trying to take it a step further by simulating hitting the ENTER key in the
IE window. i manually tested hitting ENTER in the IE window and it does what
i want but for some reason it does not work programmatically...

If lHwnd < 0 Then
ShowWindow lHwnd, SW_SHOWNORMAL
Dim XT As Long
XT = BringWindowToTop(lHwnd) 'brings the IE window to top
Windows.Application.SendKeys "{ENTER}"
SendKeys "{ENTER}"

thanks in advance,
geebee

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default simulate pressing enter not working

Gary, possibly as the OP has posted here if he is using Excel VBA

GeeBee, I expect there's a way to automate IE and its document and "submit"
without resorting to
SendKeys. It would though mean knowing a little more about the html document
and iexplore's methods (which I don't).

In the meantime you might check your IE window really is the active window
with the GetActiveWindow API. Failing that try the other two API's show
below (careful with line wrapping)

Public Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow"
() As Long
Public Declare Function SetForegroundWindow Lib "user32" Alias
"SetForegroundWindow" (ByVal hwnd As Long) As Long
Public Declare Function SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd
As Long) As Long

None of these API's of course would ensue your particular button is in
focus, unless it is by default.

Regards,
Peter T
Regards,
Peter T



"Gary Brown" wrote in message
...
GeeBee,
You've inadvertently posted to the Excel forum. You might want to try
again in the IE forum. Sorry we can't help.
Sincerely,
Gary Brown


"geebee" wrote:

hi,

i have the following. it basically puts the focus on the IE window.

but im
trying to take it a step further by simulating hitting the ENTER key in

the
IE window. i manually tested hitting ENTER in the IE window and it does

what
i want but for some reason it does not work programmatically...

If lHwnd < 0 Then
ShowWindow lHwnd, SW_SHOWNORMAL
Dim XT As Long
XT = BringWindowToTop(lHwnd) 'brings the IE window to top
Windows.Application.SendKeys "{ENTER}"
SendKeys "{ENTER}"

thanks in advance,
geebee



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
WYA Converts to WAY after pressing enter ket Roger Cookson Excel Discussion (Misc queries) 3 December 16th 05 05:24 PM
Pressing Enter Key Yo Setting up and Configuration of Excel 4 October 28th 05 10:59 PM
VBA to simulate the enter button? Bob O[_2_] Excel Programming 3 August 15th 05 05:16 PM
simulate a enter key behaviour? Liedson31 Excel Programming 2 June 17th 05 02:52 PM
Cursor not to move when pressing the enter key Alex Martinez Excel Programming 2 May 12th 05 07:49 PM


All times are GMT +1. The time now is 11:56 PM.

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

About Us

"It's about Microsoft Excel"