View Full Version : Controlling pop-up IE windows

07-06-2017, 02:40 AM
Hi guys,
I am writing a VBA to print a IE page.

So i will open IE, navigate an url, then there is an img that when I click it, there will be a pop-up IE window, which I would like to print the pop up IE window, please help,

Sub WebLogin()
Dim ie As Object
Set ie = New InternetExplorerMedium
With ie
.Visible = True
.navigate URL

Do While .readyState <> 4 Or .Busy = True
.Visible = True

Set Inputcollection = .document.getElementsByTagName("img")
For Each Inputtarget In Inputcollection
If Inputtarget.ID = "popup" Then
Inputtarget.FireEvent "onclick"
Exit For
End If
Next Inputtarget

'print the pop up IE

End With
End Sub

Thank you