I am very new to VB and have a simple code in Outlook to save my attachments from Outlook to the drive. I want to link them in Access from the drive but the files are sent in xlsx format and I have Access 2003. So can I edit my Outlook code to save the attachment in xls format?
Here is the code:
Many thanks!
Here is the code:
Code:
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat
dateFormat = Format(itm.ReceivedTime, "yyyy-mm-dd H-mm")
saveFolder = "C:\Email Downloads"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & dateFormat & objAtt.DisplayName
Next
End Sub
Comment