Dim ieApp As InternetExplorer
Dim iePage As HTMLDocument
Dim x As Single
Dim timestart As String
Const cTIME = 10000 'in MilliSeconds
Set ieApp = New InternetExplorer
ieApp.Visible = True
'This changes based upon the document needed, hardcoded here for the example
ieApp.Navigate "https://ecf.ganb.uscourts.gov/cgi-bin/show_case_doc?20,729812,,14604849,"
'wait for page to load
Do Until ieApp.ReadyState = READYSTATE_COMPLETE
Loop
Set iePage = ieApp.Document
'Enter the User information and password in the first web page
iePage.Forms(0).Item("login").Value = "cw0133"
iePage.Forms(0).Item("key").Value = "4scirvy2"
iePage.Forms(0).Item("clcode").Value = "system"
iePage.Forms(0).Item("button1").Click
'Wait for the second page to load and hit the submit button
Call sSleep(cTIME)
ieApp.Document.Forms(0).submit
'Wait for the PDF file to load
Call sSleep(cTIME)
'***********************************************************************************************
'This is my problem area it opens a new browser instead of using the one that has gone through the security check
'Download the PDF file - hardcoded url and file name for this example
If URLDownloadToFile(0&, "https://ecf.ganb.uscourts.gov/cgi-bin/show_case_doc?20,729812,,14604849,", "c:\TEMP\TEST110908.PDF", 0&, 0&) = 0 Then
MsgBox "Downloaded"
Else
MsgBox "Failed"
End If
'***********************************************************************************************
' Kill the browser
Set ieBrowser = Nothing
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE