in a macro it seems that this code doesn't work
For iii = 1 To 10
AppActivate ("Mozilla Firefox")
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
Sleep 1000
Next iii
but when it reached the stop and i set the line
Call ShowWindow(aaaMozillaFirefox, 3) 'maximize firefox
as new input line and i press F5 it works
can someone help me with this, thanks a lot
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hwnd As Long, lpdwProcessId As Long) As Long
Declare Function AttachThreadInput Lib "user32" (ByVal idAttach As Long, ByVal idAttachTo As Long, ByVal fAttach As Long) As Long
Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const SW_SHOWMAXIMIZED = 3
Const VK_TAB = &H9
Private Const KEYEVENTF_KEYUP = &H2
sub b
'...
'...
'...
Dim ThreadIDfirefox As Variant
Dim CurrentForegroundThreadID As Variant
Call ShowWindow(aaaexcel, 2) 'minimize excell
Call ShowWindow(aaaMozillaFirefox, 3) 'maximize firefox
ThreadIDfirefox = GetWindowThreadProcessId(aaaMozillaFirefox, ByVal 0&)
CurrentForegroundThreadID = GetWindowThreadProcessId(GetForegroundWindow(), ByVal 0&)
Call AttachThreadInput(CurrentForegroundThreadID, ThreadIDfirefox, True)
ShowWindow aaaMozillaFirefox, SW_SHOWMAXIMIZED
retval = SetForegroundWindow(aaaMozillaFirefox)
For iii = 1 To 10
AppActivate ("Mozilla Firefox")
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
Sleep 1000
Next iii
Call AttachThreadInput(CurrentForegroundThreadID, ThreadIDfirefox, False)
Stop
end sub
Bookmarks