I have some code which works great reading from my inbox. It places portions of the e-mail into a table and it works excellent! However I do not want this to pull the e-mails from my inbox, but I would like it to read the e-mails of another account or Inbox
i am connected to. Right now it is going right to my personal Inbox and pulling the e-mails and I need it to go out to another mailbox which is configured in my outlook instead....here is the code I am using and the name of the mailbox is "Mailbox - Region
1 Reporting".
Private Sub but_GetMail_Click()
Dim TempRst As DAO.Recordset
Dim rst As DAO.Recordset
Dim OlApp As Outlook.Application
Dim Inbox As Outlook.MAPIFolder
Dim InboxItems As Outlook.Items
Dim Mailobject As Object
Dim db As DAO.Database
Dim dealer As Integer
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * from tbl_outlooktemp"
Set db = CurrentDb
Set OlApp = CreateObject("Outlook.Application")
Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)
Set TempRst = CurrentDb.OpenRecordset("tbl_OutlookTemp")
'olFolderInbox
Set InboxItems = Inbox.Items
'Inbox.Items
'
For Each Mailobject In InboxItems
If Mailobject.UnRead Then
With TempRst
.AddNew
!Subject = Mailobject.Subject
!from = Mailobject.SenderName
!To = Mailobject.To
!Body = Mailobject.Body
!DateSent = Mailobject.SentOn
.Update
Mailobject.UnRead = False
End With
End If
Next
Set OlApp = Nothing
Set Inbox = Nothing
Set InboxItems = Nothing
Set Mailobject = Nothing
Set TempRst = Nothing
DoCmd.SetWarnings True
End Sub
SOMEONE PLEASE HELP??