vba macro interaction with internet explorer
===

The  macro I am building takes names from a excel spreadsheet, opens Internet Explorer, and searches the online directory.  After searching the directory, it pulls up a java form with the manager's name in it.  I am able to manually tab to the manager name, right click, copy shortcut, and then post it back on the spread sheet.  However, I am having problems with consistent tabbing and copying the shortcut.  (1) Is there a simple way of bringing focus back onto the IE window. (2) How do you copy a shortcut without manually clicking it?

Code:

    
        
    Sub Macro1()
    '
    Dim ie As Object
    Set ie = CreateObject("internetexplorer.application")
    
    ie.Visible = True
    
    ie.navigate "****url****"
    
    While ie.busy
        DoEvents
    Wend
    
    
    ie.document.getElementById("SSOID").Value = "Z19516732"
    
    
    ie.document.getElementById("Advanced").Checked = False
    
    ie.document.all("Search").Click
    
    
    'this loop is to slow the macro as the java form is filled from the search
    
    For i = 1 To 400000000  
    
    i = i + 1
    
    Next i
    
    'ie.Object.Activate
    
    ie.document.getElementById("Advanced").Checked = False
    
    ie.document.getElementById("SSOID").Focus
    
    Application.SendKeys "{TAB 6}" ', True
    
    
    'bring up the control menu/right click
    
    Application.SendKeys "+{F10}"
    
    'copyshort cut is 8 items down on the list
    
    Application.SendKeys "{DOWN}"
    Application.SendKeys "{DOWN}"
    
    Application.SendKeys "{DOWN}"
    Application.SendKeys "{DOWN}"
    Application.SendKeys "{DOWN}"
    Application.SendKeys "{DOWN}"
    Application.SendKeys "{DOWN}"
    Application.SendKeys "{DOWN}"
    
    'enter was not working so the shortcut for the menu is 't'
    
    'SendKeys "{ENTER}"
    
    Application.SendKeys "{t}"
    
    Windows("Book21").Activate
    
    Range("A1").Select
    
    ActiveSheet.Paste
    
    end sub

