im looping through elements on a webpage as
Select element click button to generate report Click link to download report click Save in IE Open/Save/Cancel bar
It appears, the download link doesnt always result in Open/Save/Cancel of Explorer to appear. Open/Save/Cancel, however, always appear if the linked pressed second time. I ideally should be checking why this happens, but as a shortcut Im trying to check if Open/Save/Cancel dialog is there and, if not, click the Download link again. Below is the code
For Each el In l
If el.innertext = "View Bill" Then
el.Click
Application.Wait (Now + TimeValue("0:00:03"))
If Application.Dialogs(xlDialogSaveAs).Show Then '.Show Then
Application.SendKeys ("%s")
Else
el.Click
Application.Wait (Now + TimeValue("0:00:03"))
Application.SendKeys ("%s")
End If
Else
End If
Next el
I expected Application.Dialogs(xlDialogSaveAs).Show to check if the Save bar is there. It might do, it might not, but the Application.Sendkeys sends Save command to the workbook im running the code from and not to the Save dialog.
Any suggestions on how to check for the Save dialog or focus back on it so Sendkeys works?
Thank you.