asked on
On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.To = tostring
.Subject = "Project Field Schedule: " & skeddeets.Cells(3, 2) & " " & skeddeets.Cells(3, 4)
.Attachments.Add savedname
.Body = "Attached please find the latest Field Schedule for the " & skeddeets.Cells(3, 2) & " " _
& skeddeets.Cells(3, 4) & " project." & vbCrLf & vbCrLf & vbCrLf
.Display '.Send
End With
Sometimes it works fine, but about half the time I get this error message: