AussieWombat
01-16-2019, 01:02 AM
I'm a chemical engineer, not a programmer.
I am receiving multiple emails (from the same sender - a piece of equipment that takes a photo and emails it every 30 mins). I need to capture the attachment (jpg file), rename it and save to a hard drive. I will do this with a VBA script run from a outlook 2016 rule.
In the ody of the email is the following txt string "Exact SubmissionTimestamp: 2018-08-23 11:00:02.197" where the 2018 onwards is the date and time of the photo.
Can someone help me with code to capture the string of the date and time and use this to rename the jpg file to save.
I have the code to save to a location, but not to do so with the new file name.
The current code I am using is
PublicSub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
DimoAttachment As Outlook.Attachment
DimsSaveFolder As String
sSaveFolder= "C:\XXX"
ForEach oAttachment In MItem.Attachments
oAttachment.SaveAsFilesSaveFolder & oAttachment.DisplayName
Next
End Sub
Thx
I am receiving multiple emails (from the same sender - a piece of equipment that takes a photo and emails it every 30 mins). I need to capture the attachment (jpg file), rename it and save to a hard drive. I will do this with a VBA script run from a outlook 2016 rule.
In the ody of the email is the following txt string "Exact SubmissionTimestamp: 2018-08-23 11:00:02.197" where the 2018 onwards is the date and time of the photo.
Can someone help me with code to capture the string of the date and time and use this to rename the jpg file to save.
I have the code to save to a location, but not to do so with the new file name.
The current code I am using is
PublicSub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
DimoAttachment As Outlook.Attachment
DimsSaveFolder As String
sSaveFolder= "C:\XXX"
ForEach oAttachment In MItem.Attachments
oAttachment.SaveAsFilesSaveFolder & oAttachment.DisplayName
Next
End Sub
Thx