Hello the world - hope all is well (It has been some time since I have been on this forum) -
Straight to it .
I have "pinched/borrowed " some coding to
open outlook and then file the sent email - however its being "awkward" and I am not seeing the issue
http://christiaanheidema.nl/?Tips_and_Tricks___Saving_e-mails_after_sending
is where I ...borrowed the coding
below seems to be the guilty party - I have attached the bd as well (Some assistance would be most welcome and would stop me throwing toys out of my pram )
Private Function FindSentItem(itemID As String, sentFromTime As Date) As Outlook.MailItem
Const MAX_TRY_COUNT = 3
Const SLEEP_TIME = 1000
Dim items As Outlook.items
Dim item As Object
Dim attempt As Integer
attempt = 1
findSentItem_start:
With olkNS.GetDefaultFolder(olFolderSentMail) **************** issue seems to be here (Error 424 ..object required) ****
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
' Call Sleep(SLEEP_TIME)
GoTo findSentItem_start
End If
Set FindSentItem = Nothing
End Function
Straight to it .
I have "pinched/borrowed " some coding to
open outlook and then file the sent email - however its being "awkward" and I am not seeing the issue
http://christiaanheidema.nl/?Tips_and_Tricks___Saving_e-mails_after_sending
is where I ...borrowed the coding
below seems to be the guilty party - I have attached the bd as well (Some assistance would be most welcome and would stop me throwing toys out of my pram )
Private Function FindSentItem(itemID As String, sentFromTime As Date) As Outlook.MailItem
Const MAX_TRY_COUNT = 3
Const SLEEP_TIME = 1000
Dim items As Outlook.items
Dim item As Object
Dim attempt As Integer
attempt = 1
findSentItem_start:
With olkNS.GetDefaultFolder(olFolderSentMail) **************** issue seems to be here (Error 424 ..object required) ****
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
' Call Sleep(SLEEP_TIME)
GoTo findSentItem_start
End If
Set FindSentItem = Nothing
End Function