J
John DOE
Hi:
I have this OLD code (Access97) that I found on the net to open Outlook and
import emails into Access. I have 2003 and know about the security pop up.
I think that Redemption can get around this. If I install it, can anyone
help me converting this code? I have searched and searched for newer code,
but either way, the security pop up is still there and I can't find code
that will do what I have here.
Thanks
PS: This could all be very old, or even too old, so any ideas would greatly
be appreciated.
*******************************************************************
Private Sub Command3_Click()
'
Dim Olapp As Outlook.Application
Dim Olmapi As Outlook.NameSpace
Dim Olfolder As Outlook.MAPIFolder
Dim OlAccept As Outlook.MAPIFolder
Dim OlDecline As Outlook.MAPIFolder
Dim OlFailed As Outlook.MAPIFolder
Dim OlMail As Object ' Have to late bind as appointments e.t.c screw it up
Dim OlItems As Outlook.Items
Dim OlRecips As Outlook.Recipients
Dim OlRecip As Outlook.Recipient
Dim Rst As Recordset
'
Set Rst = CurrentDb.OpenRecordset("tblIBN-Hold")
Set Olapp = CreateObject("Outlook.Application")
Set Olmapi = Olapp.GetNamespace("MAPI")
Set Olfolder = Olmapi.GetDefaultFolder(olFolderInbox)
Set OlItems = Olfolder.Items
Set OlAccept = Olfolder.Folders("Passed")
Set OlFailed = Olfolder.Folders("Failed")
'
' Set up a loop to run till the inbox is empty (otherwise it skips some)
Do Until OlItems.Count = 0
'
Set OlItems = Olfolder.Items
For Each OlMail In OlItems
'
If OlMail.UnRead = True Then
OlMail.UnRead = False 'Mark mail as read
Rst.AddNew
Rst!IBNUser1 = OlMail.SenderName
'
If InStr(1, OlMail.Subject, "IBN") > 0 Then
Rst!IBNMember2 = OlMail.Subject
Rst!IBNDate = OlMail.ReceivedTime
Rst!IBNTime = OlMail.ReceivedTime
Rst!IBNBody = OlMail.Body
Rst!IBNHold = "True"
OlMail.Move OlAccept
Else
Rst!IBNMember2 = OlMail.Subject
Rst!IBNDate = OlMail.ReceivedTime
Rst!IBNTime = OlMail.ReceivedTime
Rst!IBNBody = OlMail.Body
Rst!IBNHold = "False"
OlMail.Move OlFailed
End If
'
Rst.Update
'
End If
'
Next
'
Loop
MsgBox "Your wish is my command. New mails have been checked. Please check
the tbl_temp for details", vbOKOnly
'
End Sub
I have this OLD code (Access97) that I found on the net to open Outlook and
import emails into Access. I have 2003 and know about the security pop up.
I think that Redemption can get around this. If I install it, can anyone
help me converting this code? I have searched and searched for newer code,
but either way, the security pop up is still there and I can't find code
that will do what I have here.
Thanks
PS: This could all be very old, or even too old, so any ideas would greatly
be appreciated.
*******************************************************************
Private Sub Command3_Click()
'
Dim Olapp As Outlook.Application
Dim Olmapi As Outlook.NameSpace
Dim Olfolder As Outlook.MAPIFolder
Dim OlAccept As Outlook.MAPIFolder
Dim OlDecline As Outlook.MAPIFolder
Dim OlFailed As Outlook.MAPIFolder
Dim OlMail As Object ' Have to late bind as appointments e.t.c screw it up
Dim OlItems As Outlook.Items
Dim OlRecips As Outlook.Recipients
Dim OlRecip As Outlook.Recipient
Dim Rst As Recordset
'
Set Rst = CurrentDb.OpenRecordset("tblIBN-Hold")
Set Olapp = CreateObject("Outlook.Application")
Set Olmapi = Olapp.GetNamespace("MAPI")
Set Olfolder = Olmapi.GetDefaultFolder(olFolderInbox)
Set OlItems = Olfolder.Items
Set OlAccept = Olfolder.Folders("Passed")
Set OlFailed = Olfolder.Folders("Failed")
'
' Set up a loop to run till the inbox is empty (otherwise it skips some)
Do Until OlItems.Count = 0
'
Set OlItems = Olfolder.Items
For Each OlMail In OlItems
'
If OlMail.UnRead = True Then
OlMail.UnRead = False 'Mark mail as read
Rst.AddNew
Rst!IBNUser1 = OlMail.SenderName
'
If InStr(1, OlMail.Subject, "IBN") > 0 Then
Rst!IBNMember2 = OlMail.Subject
Rst!IBNDate = OlMail.ReceivedTime
Rst!IBNTime = OlMail.ReceivedTime
Rst!IBNBody = OlMail.Body
Rst!IBNHold = "True"
OlMail.Move OlAccept
Else
Rst!IBNMember2 = OlMail.Subject
Rst!IBNDate = OlMail.ReceivedTime
Rst!IBNTime = OlMail.ReceivedTime
Rst!IBNBody = OlMail.Body
Rst!IBNHold = "False"
OlMail.Move OlFailed
End If
'
Rst.Update
'
End If
'
Next
'
Loop
MsgBox "Your wish is my command. New mails have been checked. Please check
the tbl_temp for details", vbOKOnly
'
End Sub