Hi Tony,
An extra bit of info:- If I dump the security patch 892843 it works as
expected but 892843 needs to be installed doesn't it?
If I comment out the trouble spots it works
OK which is not OK really is it?
Here is the code, same as most examples. With the error trapping it will
work after trying a few times.... not very good fix though.
Sub CheckForNewIncidents()
On Error GoTo Err_CheckForNewIncidents
Dim intICNT As Integer
Dim intACTCNT As Integer
Dim intINUM As Integer
Dim intI As Integer
Dim intX As Integer
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim str_Recipients As String
Dim str_SubjectText As String
Dim str_BodyText As String
Dim AttachmentPath As String
Dim DisplayMSG As Boolean
DisplayMSG = True
intACTCNT = getIncidentCount(2)
If intACTCNT > 0 Then
'Find the incident
For intI = 1 To intACTCNT
intINUM = GetNewIncidentNumber()
If intINUM = 0 Then
Exit Sub
Else
str_Recipients =
GetSupervisorEmailAddress(GetSupervisor(intINUM))
str_SubjectText = "Helpdesk request from " &
GetRequester(intINUM)
str_BodyText = "The problem is " & GetIncidentText(intINUM)
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(str_Recipients)
With objOutlookRecip
'
.Type = olTo
'has trouble here
End With
'
' Set the Subject, Body, and Importance of the message.
.Subject = str_SubjectText
.Body = str_BodyText
.Importance = olImportanceNormal 'High importance
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
'
objOutlookRecip.Resolve
'and here
Next
'
' Should we display the message before sending?
If DisplayMSG Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing
intX = SetIncident(1, intINUM)
If intX <> 0 Then
MsgBox "Update Failed", vbOKOnly, "TABLE WRITE FAILURE"
End If
End If
Next
End If
Exit_CheckForNewIncidents:
Exit Sub
Err_CheckForNewIncidents:
If Err.Number = 287 Then
Resume
Else
MsgBox Err.Number & " " & Err.Description, 48, "ERROR DETECTED"
Resume Exit_CheckForNewIncidents
End If
End Sub