Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
WYA Converts to WAY after pressing enter ket | Excel Discussion (Misc queries) | |||
Pressing Enter Key | Setting up and Configuration of Excel | |||
VBA to simulate the enter button? | Excel Programming | |||
simulate a enter key behaviour? | Excel Programming | |||
Cursor not to move when pressing the enter key | Excel Programming |