fetching blocked attachments

Not open for further replies.


New Member
Outlook version
Outlook 2016 32 bit
Email Account
Exchange Server
I have adjusted windows registry to block certain attachments (xls, doc, xlsm, docm), so users won't accidentally, on auto pilot, execute an attachment, potentially harboring a malware. For those who are unaware, files carrying those extensions, can contain macro vba code. In my opinion, there's no reason to be using those formats via email.
With the registry block in place, the user sees the email has an attachment, but the contents of the message, prohibits user from accessing the attachment; instead a message is presented stating the attachment has been blocked.
This approach to blocking is effective, but, would like to be able to download these attachments to a folder. I had hoped to create a vba add-in, allowing user to see the blocking occur, but still allow them to download safely with my add-in; my add-in would save these attachments to a folder on the desktop, and open them via 'sandboxie' application; the 'sandboxie' application, basically allows you to open suspect, quarantined items, in a closed environment, that is scrapped as soon as you close the window; preventing any changes to the computer. I want to do this because, the users still have a need for viewing the content of these potentially harmful attachments, as some of them will be legitimate.
I realize, the windows registry is configured to block these attachments via the outlook user interface, but know the attachments are still physically present, in the outlook mail store (unblocking via windows registry returns access to these attachments).

The following code, downloads the attachments from the email message in focus; can anybody think of away to alter my code, so it can see blocked attachments. Currently, with blocking enabled, it does not see the attachments.

Public Sub saveAttachtoDisk()
    Dim objAtt As Outlook.Attachment
    Dim olMsg As Outlook.MailItem
    Dim strDate As String
    Dim strName As String
    Dim saveFolder As String
    Dim saveSubFolder As String
    Dim x As Long
    saveFolder = Environ("userprofile") & "\desktop\BlockedAttachments\"
    On Error Resume Next
    'detect folder
    x = GetAttr(saveFolder)
    If Err.Number <> 0 Then
        MkDir saveFolder
    End If
    saveSubFolder = saveFolder & Month(Date) & "-" & Day(Date) & "-" & Year(Date) & "\"
    'detect folder
    x = GetAttr(saveSubFolder)
    If Err.Number <> 0 Then
        MkDir saveSubFolder
    End If

    Set olMsg = ActiveExplorer.Selection.Item(1)
    For Each objAtt In olMsg.Attachments
        objAtt.SaveAsFile saveSubFolder & objAtt.FileName
    Next objAtt
    Set objAtt = Nothing
    Set olMsg = Nothing
    Exit Sub
End Sub
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Emails fetching into Excel and auto generating Dashboard Using Outlook 2
Commodore Outlook 2007 stops fetching Facebook updates Using Outlook 5
F Junk Email does not get added to the Blocked Sender List Using Outlook 4
GregS Outlook 365 blocked by Google popup Using Outlook 2
T How can we view Blocked email addresses Using Outlook 6
N Outlook 2010 Flag blocked for Safe Senders List???? Using Outlook 7
M Blocked Sender List @Domain Not Working Using Outlook 0
Diane Poremsky Add to Safe (and Blocked) Senders for Users New Slipstick.com Articles 0
R Blocked Top-Level Domain List Using Outlook 2
G Not able to send ANY emails due to a blocked list Using Outlook 2
M All e mails seem to be getting blocked BCM (Business Contact Manager) 7
N Blocked senders list disappears Using Outlook 4
D "Outlook has blocked access to this form template file. Outlook VBA and Custom Forms 3
L Macro/VBA to Reply All, with the original attachments Outlook VBA and Custom Forms 2
A Attachments.Delete Outlook VBA and Custom Forms 3
M Deleting attachments does not reduce file size Using Outlook 0
L unblocking attachments before sending Office 365 Advanced Protection Using Outlook 0
I Saving attachments from multiple emails and updating file name Outlook VBA and Custom Forms 0
R Use an ItemAdd to Save Attachments on Arrival Outlook VBA and Custom Forms 0
shrydvd vba to secure zip attachments Outlook VBA and Custom Forms 3
H Outlook 2016 sent over 30 copies of an e-mail with attachments Using Outlook 1
W Automatically open attachments without automatically printing them Using Outlook 0
O Save attachments using hotkey without changing attributes Outlook VBA and Custom Forms 1
T Outlook converts sent email to txt attachments when sync Using Outlook 0
Nadine Rule to move attachments with specific name Outlook VBA and Custom Forms 1
R Outlook is NOT removing attachments. Using Outlook 4
Dan_W Nested email attachments Outlook VBA and Custom Forms 4
M Print email and, attachments sent in hyperlinks in the email Outlook VBA and Custom Forms 2
W Save and rename outlook email attachments to include domain name & date received Outlook VBA and Custom Forms 4
D Print attachments automatically and moves the mail to a new folder Outlook VBA and Custom Forms 9
G Download pdf attachments only if email subject has one of words Outlook VBA and Custom Forms 8
D Saving Selected Emails as PDF and saving Attachments Outlook VBA and Custom Forms 6
R Quick Access view in File Explorer when saving attachments Using Outlook 0
J Save E-mail attachments in a specific folder Outlook VBA and Custom Forms 0
O Wishlist Native solution to detach attachments but keep a link to them Outlook Wishlist 1
broadbander Needing help with reply/reply all while keeping attachments and adding a new CC recipient. Outlook VBA and Custom Forms 5
I Forwarding attachments in email received Outlook VBA and Custom Forms 3
A Outlook - Send New 20 Attachments through Email Using Outlook 4
D Print Attachments only in selected emails using a macro Outlook VBA and Custom Forms 3
M Outlook 2016 msg attachments Using Outlook 0
N Saving And Deleting Outlook Attachments with Unknown Error Message Outlook VBA and Custom Forms 1
M Macro for attachments download adjustment Outlook VBA and Custom Forms 3
M VBA macro for Inbox's attachments search Outlook VBA and Custom Forms 0
C Auto save outlook attachments when email is received Outlook VBA and Custom Forms 1
S Outlook 2010 Cannot Open Attachments Using Outlook 14
I Print Automatically Attachments Outlook VBA and Custom Forms 3
Diane Poremsky Save Messages and Attachments to a New Folder New Slipstick.com Articles 0
B Delete/replace old files and save new attachments Using Outlook 1
J Saving attachments from specific sender (phone number) to specific folder on hard drive Using Outlook 3

Similar threads