Forum Discussion
CopyCatCoder
Jul 26, 2024Copper Contributor
VBA Automation Internet Explorer popup window button click
Sub CDOpenDuplicate()
Dim ieapp As New InternetExplorerMedium
Dim Doc As New HTMLDocument
'Set ieapp = New InternetExplorerMedium
With ieapp
.Visible = True
.navigate "http://xxxx.cvxc.local/Apps/sdfg/xxReports/Mat/cbvnnn_Edit.asp?trans_id=39859109&parm=4353"
Do Until ieapp.readyState = READYSTATE_COMPLETE: DoEvents: Loop
Set Doc = ieapp.document
Doc.getElementById("btnRemove").Click
'Do Until IEApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop
Application.SendKeys ("{ENTER}")
End With
End Sub
This code stuck here Doc.getElementById("btnRemove").Click
I am clicking on a Save button on the page after which a confirmation window pops up which has a button "Yes" "No" .
I wanted to click on Yes button and proceed with VBA. I am not able to track this window neither in Power Automate nor in VBA. Right click is also not allowed. It does not even let click anywhere outside the page. refer the snapshot below. What should I do? I guess the window is Modeless.
I tried to set focus on the window also with below code but failed.
Sub Test1()
Dim SWs As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer
Dim Doc
For Each IE In SWs
On Error Resume Next
Set Doc = IE.document
If TypeOf Doc Is HTMLDocument Then
Debug.Print Doc.Title
End If
VBA.AppActivate IE.document.Title, 10000
Application.SendKeys ("{ENTER}")
On Error GoTo 0
Next
End Sub
No RepliesBe the first to reply