Using VBA to automatically save attachment to network folder
Hi there.
I am currently using the below code to strip attachments out of inbound emails and save to a shared folder within my network
Code:
Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "P:\OUTLOOKDUMP\"
For Each oAttachment In MItem.Attachments
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
Next
End Sub
What I am wanting to do is when the file is stripped and saved, to edit the name that it is saved as.
Right now the file comes in as GENERIC_TEXT_123456789.pdf
The Text is the same for each file... ONLY the numbers before the ".pdf" change. I would like to save the file as just that number.pdf
How do I go about doing this???