Link to home
Create AccountLog in
Avatar of Ryan Rood
Ryan RoodFlag for Canada

asked on

Outlook VBA Addin

I found this code snippet on another site:

This works! Which is great. However I would like to modify this to only grab PDF files from the emails and prepend a date to the file name (yyyymmdd - original filename). I have zero programming knowledge. I have found a few different sites and have tried to modify but it just breaks the code and the script stops working. Any assistance would be appreciated.

Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "C:\Users\DT168\Documents\outlook-attachments\"
For Each oAttachment In MItem.Attachments
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
End Sub
Avatar of Rgonzo1971

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Ryan Rood


Thank you so much! That is exactly what I needed! :)