Hmmm. I was afraid of that
However, the following may work for you, either run from a rule or by selecting the message and running the GetMsg macro.
Tested with a message containing a link to a ZIP file on my web site https://www.gmayor.com/Zips/Custom%2...%20Control.zip
The process does download the file to the folder strPath.
Because you have not said what other links might be in the message or what type of file the link, links to the filter
If InStr(1, oLink.Address, "/") > 0 And _
Left(LCase(oLink.Address), 4) = "http" Then
may be insufficient to identify the file. You may have to make some adjustments to ensure you only get the required link and thus correct file. I have not made any account of the possibility that the filename may already exist. In such a case the existing file will be overwritten.
Option Explicit
Private Declare Function URLDownloadToFile _
Lib "urlmon" Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Sub GetMsg()
Dim olMsg As MailItem
On Error Resume Next
Set olMsg = ActiveExplorer.Selection.item(1)
DownloadLinkedFile olMsg
lbl_Exit:
Exit Sub
End Sub
Sub DownloadLinkedFile(olItem As MailItem)
Dim olEmail As Outlook.MailItem
Dim olInsp As Outlook.Inspector
Dim wdDoc As Object
Dim oRng As Object
Dim oLink As Object
Dim vAddr As Variant
Dim strFName As String
Dim strURL As String
Dim strLocal As String
Const strPath As String = "C:\Path\Attachments\"
On Error Resume Next
With olItem
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Range
For Each oLink In oRng.hyperlinks
If InStr(1, oLink.Address, "/") > 0 And _
Left(LCase(oLink.Address), 4) = "http" Then
vAddr = Split(oLink.Address, "/")
strFName = vAddr(UBound(vAddr))
strURL = oLink.Address
End If
Next oLink
End With
strLocal = strPath & strFName 'here the drive and download directory
If URLDownloadToFile(0, strURL, strLocal, 0, 0) = 0 Then
MsgBox strFName & " - downloaded"
Else
MsgBox strFName & " - download failed"
End If
lbl_Exit:
Set olInsp = Nothing
Set oRng = Nothing
Set oLink = Nothing
Exit Sub
End Sub