Public Sub db_upload() 'download file from outlook Dim ns As Outlook.Namespace Dim inbox As Outlook.MAPIFolder Dim mail As Object Dim attachmnt As Outlook.Attachment Dim fname As String Dim docPath As String Dim i As Integer Dim wsh As Object Dim fs As Object cnt = 0 Set ns = GetNamespace("MAPI") Set inbox = ns.GetDefaultFolder(olFolderInbox) maildt = Format(Now, "dd-mm-yyyy") For Each mail In inbox.Items On Error Resume Next namesender = mail.SenderName mailsub = mail.Subject maildate = Format(mail.ReceivedTime, "dd-mm-yyyy") If InStr(mail.Subject, "something") > 0 And Format(mail.ReceivedTime, "dd-mm-yyyy") = maildt Then For Each attachmnt In mail.Attachments fname = attachmnt.Filename attachmnt.SaveAsFile "path" & attachmnt.Filename cnt = cnt + 1 Next attachmnt End If Next mail Set inbox = Nothing Set ns = Nothing Set fs = Nothing Set wsh = Nothing End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)