Dim DisplayBox As VbMsgBoxResult
'find the right internet explorer webpage
Dim allExplorerWindows As New SHDocVw.ShellWindows
Set allExplorerWindows = New SHDocVw.ShellWindows
Dim IEwindow As SHDocVw.InternetExplorer
Dim foundFlag As Boolean
foundFlag = False
For Each IEwindow In allExplorerWindows
If InStr(IEwindow.LocationURL, ".xxxxxx.us") <> 0 Then
foundFlag = True
Exit For 'found the right IE window URL
End If
Next
If Not foundFlag Then
DisplayBox = MsgBox("Could not find an open instance of xxxx xxxx running." _
& vbNewLine & vbNewLine & " " & _
"You can contact the program author if assistance is needed." & _
vbNewLine & "xxxxxxxx" & _
vbNewLine & "email at xxxxxxx", _
vbOKOnly + vbMsgBoxSetForeground, "Please try again.")
GoTo Exit_Get_DA
End If
IEwindow.Visible = True 'set IE window to active
'end find
'set myHTMLDoc to the main pages IE document
Dim myHTMLDoc As HTMLDocument
Set myHTMLDoc = IEwindow.document
'get sub frame0 from myHTMLDoc
Dim SubFrame0 As HTMLDocument
Set SubFrame0 = myHTMLDoc.frames(0).document
'get sub frame1 from myHTMLDoc
Dim SubFrame1 As HTMLDocument
Set SubFrame1 = myHTMLDoc.frames(1).document
'Navigate frame1 to the TAS module
Do: Loop Until Not IEwindow.Busy 'wait until IE is finished loading
SubFrame1.URL = "[URL]https://xx.xxxxx.xx/servlets/iclientservlet/xxxxx/?ICType=Nav[/URL]"
'Navigate to the Course Profile area
Do: Loop Until Not IEwindow.Busy 'wait until IE is finished loading
Dim SubSubFrame As HTMLDocument
Set SubSubFrame = SubFrame1.frames(2).document
SubSubFrame.URL = "[URL]https://xx.xxxxx.xx/servlets/iclientservlet/xxxxx/?ICType=Panel&Menu=ADMINISTER_TRAINING_(GBL)&Market=GBL&PanelGroupName=COURSE_TABLE2[/URL]"
'enter the course # and then press the "search" button
Do: Loop Until Not IEwindow.Busy 'wait until IE is finished loading
SubSubFrame.getElementById("ALL_CRS_SRCH_VW_COURSE").Value = "340720"
SubSubFrame.getElementById("#ICSearch").Click