+ Reply to Thread
Results 1 to 4 of 4

window firefox do not activate

Hybrid View

  1. #1
    Registered User
    Join Date
    03-16-2009
    Location
    italy
    MS-Off Ver
    Excel 2003
    Posts
    64

    window firefox do not activate

    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
    Last edited by ilkamalo; 04-03-2010 at 10:39 AM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: window firefox do not activate

    Remember to use code tags.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    03-16-2009
    Location
    italy
    MS-Off Ver
    Excel 2003
    Posts
    64

    Re: window firefox do not activate

    sorry to broke rule it wasn't intentionally,i will pay more attention next time

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: window firefox do not activate

    Well start by adding them
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1