Crewchief521
New Member
- Joined
- Apr 14, 2019
- Messages
- 18
I have some code that runs flawlessly on my computer, but when i try it on a co-workers computer, the new IE window opens up in the background and the sendkeys lines of code dont work. Any ideas on why it works on mine but not theirs? I have searched and tried just about anything i could think of. Here is the code
Code:
Sub getAWPdata() Dim IE As SHDocVw.InternetExplorer
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInput As MSHTML.IHTMLElement
Dim HTMLAs As MSHTML.IHTMLElementCollection
Dim HTMLA As MSHTML.IHTMLElement
Dim wb As Workbook
Dim oShell As Object
Set oShell = CreateObject("WScript.Shell")
Application.ScreenUpdating = False
If MsgBox("Please make sure you have an active MRO Apps session open!", vbOKCancel, "Active Session") = vbCancel Then Exit Sub
MsgBox "This process will take about 2 minutes to complete, please be patient.", vbOKOnly, "Process Time"
Set IE = New InternetExplorerMedium
'open IE to MRO Apps
IE.Visible = True
IE.Navigate "https://mro.hill.af.mil/MROApps/spring/awpData"
Do While IE.ReadyState <> READYSTATE_COMPLETE
Loop
oShell.AppActivate IE.Name
Set HTMLDoc = IE.Document
Application.Wait (Now + TimeValue("00:00:10"))
'click export to csv link
Set HTMLInput = HTMLDoc.getElementById("form:btnCsvExport")
HTMLInput.Click
Application.Wait (Now + TimeValue("00:00:10"))
'open new excel file
SendKeys "%{N}"
Application.Wait (Now + TimeValue("00:00:01"))
SendKeys "{ENTER}"
'run procedure "CopyAWPData
Application.OnTime Now + TimeValue("00:00:20"), "CopyAWPData"
'run procedure "getSOSdata
Application.OnTime Now + TimeValue("00:00:20"), "getSOSdata"
SendKeys "{NUMLOCK}", True
Application.ScreenUpdating = True
IE.Quit
End Sub
Last edited: