Hi,
I am trying to automate the process of downloading a file which is contained at a web address that I receive a hyperlink to in a daily email. I have found various sources to follow the hyperlink and open the web address. However, I am now stuck when the internet explorer downloads box opens and asks me whether to Open, Save or Save As. I have no idea how to control this dialogue box. Can any one help? Thank you in advance!
This is the download manager which I need to control:
Download Manager.jpg
Here is my code so far:
HTML Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub MyCustomSub (Item As Outlook.MailItem)
Dim bodyString As String
Dim bodyStringSplitLine
Dim bodyStringSplitWord
Dim splitLine
Dim splitWord
Dim Hyperlink As String
Dim LocalFileName As String
Dim sURL As String
Dim filename As String
Dim itm As Outlook.MailItem
Dim IE As Object
Const UNC = "MyDestination\"
bodyString = itm.Body
bodyStringSplitLine = Split(bodyString, vbCrLf)
For Each splitLine In bodyStringSplitLine
bodyStringSplitWord = Split(splitLine, " ")
For Each splitWord In bodyStringSplitWord
Test = InStr(splitWord, "MyHyperlink.HTML")
If Test = 1 Then
Hyperlink = splitWord
End If
Next
Next
filename = "MyFilename" & Date
LocalFileName = UNC & filename
ShellExecute 0, "open", "C:\Program Files\Internet Explorer\iexplore.exe", Hyperlink, vbNullString, 1
End Sub