G
Guest
I have a problem with the code listed below, my access database has Outllook
EntityID's stored in it & I would like to now save the actual emails to a
certain directory, the problem is that the EntityID's are from different
computers, I need to be able to skip messages that cause an error.
Code:
Private Sub Command74_Click()
On Error GoTo Err_Command74_Click:
Dim rs As Object
rs.MoveFirst
Do
Set myolApp = CreateObject("Outlook.Application")
Set myNameSpace = myolApp.GetNamespace("MAPI")
If Me.Category = "SENT" Then
Set myFolder = myNameSpace.GetDefaultFolder(5)
ElseIf Me.Category = "RECEIVED" Then
Set myFolder = myNameSpace.GetDefaultFolder(6)
End If
Set myMail = myNameSpace.GetItemFromID(Me.OutlookID)
myMail.SaveAs "c:\eMail\" & Me.OutlookID & ".msg" & olMSG
rs.MoveNext
Loop While Not rs.EOF
Exit_Command74_Click:
Exit Sub
Err_Command74_Click:
Resume Exit_Command74_Click:
End Sub
EntityID's stored in it & I would like to now save the actual emails to a
certain directory, the problem is that the EntityID's are from different
computers, I need to be able to skip messages that cause an error.
Code:
Private Sub Command74_Click()
On Error GoTo Err_Command74_Click:
Dim rs As Object
rs.MoveFirst
Do
Set myolApp = CreateObject("Outlook.Application")
Set myNameSpace = myolApp.GetNamespace("MAPI")
If Me.Category = "SENT" Then
Set myFolder = myNameSpace.GetDefaultFolder(5)
ElseIf Me.Category = "RECEIVED" Then
Set myFolder = myNameSpace.GetDefaultFolder(6)
End If
Set myMail = myNameSpace.GetItemFromID(Me.OutlookID)
myMail.SaveAs "c:\eMail\" & Me.OutlookID & ".msg" & olMSG
rs.MoveNext
Loop While Not rs.EOF
Exit_Command74_Click:
Exit Sub
Err_Command74_Click:
Resume Exit_Command74_Click:
End Sub