How do i press open on IE popup

dmavro

New Member
Joined
Jul 31, 2009
Messages
22
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....
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.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,215,360
Messages
6,124,492
Members
449,166
Latest member
hokjock

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top