Hi. I need to find a way of downloading a PDF file from an OPEN internet explorer window and then SAVE AS like i have tried in my sample code.
That code seem to work for HTML pages but not PDFs.
The idea is to download new documents from an open webpage, where a login password is needed.
Since there is a password necessary on the website, using System.Net.WebClient seem not to be an option ( i couldn't get it to login correctly)
Dim objStream1 As New System.Net.WebClient
I have also tried varios SEND KEYS to the window, but its not working and usually doesn't give that much stability
Sub saveas(ByVal url As String)
Dim filename2 As String
Dim doc As mshtml.HTMLDocument
For Each window In shellWindows
Dim HTMLdocument2 As Object
IEInstance = window '...see if they are IE windows...
filename2 = Path.GetFileNameWithoutExtension(IEInstance.FullName).ToLower()
If filename2.Equals("iexplore") Then
Timer1.Enabled = False
filename2 = IEInstance.LocationURL
If filename2.ToString = url.ToString Then
Loop Until Not IEInstance.Busy
IEInstance.ExecWB(SHDocVw.OLECMDID.OLECMDID_SAVECOPYAS, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, "C:\testing.pdf", Nothing)