Interação VBA com o Internet Explorer
A macro que estou criando recebe nomes de uma planilha do Excel, abre o Internet Explorer e pesquisa o diretório online. Depois de pesquisar no diretório, ele obtém um formulário Java com o nome do gerente. Eu sou capaz de tabular manualmente para o nome do gerente, clique direito, copiar atalho e, em seguida, postá-lo novamente na planilha. No entanto, estou tendo problemas com tabulações consistentes e copiando o atalho.
Existe uma maneira simples de trazer o foco de volta para a janela do IE?Como você copia um atalho sem clicar nele manualmente?Código:
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}"
'copy shortcut 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