I have code that presses a button that downloads a file on an IE page. After the code runs a window pops up at the bottom of the IE page and I cant figure out how to press any of the buttons on it. I use this to get to where I need....
But then the smaller window with an orange border at the top appears that asks me if I want to open or save the file from the website.
Any help would be greatly appreciated.
Code:
Sub GetETBData()
Dim ie As New SHDocVw.InternetExplorer
Dim User As String
Dim Pass As String
Dim LR As Long
Dim htmlDoc As MSHTML.HTMLDocument 'Microsoft HTML Object Library
Dim htmlInput As MSHTML.HTMLInputElement
Dim htmlColl As MSHTML.IHTMLElementCollection
LR = Sheets("EasyToBorrow").Range("A" & Rows.Count).End(xlUp).Row
Sheets("EasyToBorrow").Range("A1:A" & LR).ClearContents
Set ie = CreateObject("InternetExplorer.Application")
'Asks user for password and username ID's for the site
User = "******"
Pass = "******"
'Creates webpage and logs into website.
With ie
'.FullScreen = True
.MenuBar = 1
.Toolbar = 1
.Visible = True
.Navigate "[URL]https://clientcenter.tradestation.com/support/myaccount/stockloan.aspx[/URL]"
Do Until .ReadyState = 4
DoEvents
Loop
'DoEvents
Set htmlDoc = .Document
Set htmlColl = htmlDoc.getElementsByTagName("input")
For Each htmlInput In htmlColl
If htmlInput.Name = "ctl00$SafeWebUIContentPlaceHolder$asxtUserName" Then
.Document.all.Item("ctl00$SafeWebUIContentPlaceHolder$asxtUserName").Value = User
.Document.all.Item("ctl00$SafeWebUIContentPlaceHolder$asxtPassword").Value = Pass
.Document.all.Item("ctl00_SafeWebUIContentPlaceHolder_asxbLogin_BImg").Click
End If
Next htmlInput
'Do Until .ReadyState = 4
' DoEvents
'Loop
Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
ie.Document.parentWindow.execScript "DownloadETB(this);", "JavaScript"
End With
Set ie = Nothing
Set htmlDoc = Nothing
Set htmlInput = Nothing
Set htmlColl = Nothing
Sheets("EasytoBorrow").Activate
Range("A1").Select
End Sub
But then the smaller window with an orange border at the top appears that asks me if I want to open or save the file from the website.
Any help would be greatly appreciated.