Hi Guys
I am sure this is a quickie
I am passing through from access to outlook ( I can get it to send from default and also send from an alterntive account (2)
but the filing system looks at the default "get Default" how do I get it to look at the sent account (2) profile ??
Dim olkns As Outlook.NameSpace
Dim items As Outlook.items
Dim item As Object
Dim attempt As Integer
Set olkapp = Outlook.Application
'###
Set olkns = olkapp.GetNamespace("MAPI")
attempt = 1
findSentItem_start:
With olkns.GetDefaultFolder(olFolderSentMail)
Set items = .items.Restrict("[SentOn] >= '" & Format(sentFromTime, "ddddd h:nn AMPM") & "'")
For Each item In items
If TypeName(item) = "MailItem" Then
If item.Categories = itemID Then
Set FindSentItem = item
Exit Function
End If
End If
Next item
End With
'
' If not found at this attempt, try again
' after some sleep
'
If attempt < MAX_TRY_COUNT Then
attempt = attempt + 1
' Pause (0.1)is 0.1 second
Pause (3)
'Call Sleep(SLEEP_TIME)
GoTo findSentItem_start
End If
Set FindSentItem = Nothing
I am sure this is a quickie
I am passing through from access to outlook ( I can get it to send from default and also send from an alterntive account (2)
but the filing system looks at the default "get Default" how do I get it to look at the sent account (2) profile ??
Dim olkns As Outlook.NameSpace
Dim items As Outlook.items
Dim item As Object
Dim attempt As Integer
Set olkapp = Outlook.Application
'###
Set olkns = olkapp.GetNamespace("MAPI")
attempt = 1
findSentItem_start:
With olkns.GetDefaultFolder(olFolderSentMail)
Set items = .items.Restrict("[SentOn] >= '" & Format(sentFromTime, "ddddd h:nn AMPM") & "'")
For Each item In items
If TypeName(item) = "MailItem" Then
If item.Categories = itemID Then
Set FindSentItem = item
Exit Function
End If
End If
Next item
End With
'
' If not found at this attempt, try again
' after some sleep
'
If attempt < MAX_TRY_COUNT Then
attempt = attempt + 1
' Pause (0.1)is 0.1 second
Pause (3)
'Call Sleep(SLEEP_TIME)
GoTo findSentItem_start
End If
Set FindSentItem = Nothing