Insira todos os seus e-mail no seu banco de dados.
Private Sub ReadInboxInsertDB()Dim TempRst As DAO.RecordsetDim Rst As DAO.RecordsetDim OlApp As Outlook.ApplicationDim Inbox As Outlook.MAPIFolderDim InboxItems As Outlook.ItemsDim Mailobject As ObjectDim db As DAO.DatabaseDim dealer As IntegerSet db = CurrentDbSet OlApp = CreateObject("Outlook.Application")Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)Set TempRst = CurrentDb.OpenRecordset("TBL_MAIL")With TempRst.MoveFirstEnd WithSet InboxItems = Inbox.ItemsFor Each Mailobject In InboxItemsIf Mailobject.UnRead ThenWith TempRstIf Mailobject.Subject = "A&A" Or Mailobject.Subject = "InAnyPlace" Then.AddNewLet !Subject = Mailobject.SubjectLet !from = Mailobject.SenderNameLet !To = Mailobject.ToLet !Body = Mailobject.BodyLet !DateSent = Mailobject.SentOn.UpdateLet Mailobject.UnRead = FalseEnd IfEnd WithEnd IfNextSet OlApp = NothingSet Inbox = NothingSet InboxItems = NothingSet Mailobject = NothingSet TempRst = NothingEnd Sub
Nenhum comentário:
Postar um comentário