Run-Time Error "287" (1 Viewer)

NauticalGent

Ignore List Poster Boy
Local time
Today, 12:40
Joined
Apr 27, 2015
Messages
6,396
Hello again,

I am using Access/Office 2010 on a Windows 7 platform.

What I am trying to do sounds simple: I want to assign an Outlook Task to the individual selected in a form's combo box.

Here is my code that I took from an MSDN site:

Sub AssignedTech_AfterUpdate()
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.TaskItem
Dim myDelegate As Outlook.Recipient
Set MyItem = myOlApp.CreateItem(olTaskItem)
MyItem.Assign
Set myDelegate = MyItem.Recipients.Add("Dan Wilson")
myDelegate.Resolve
If myDelegate.Resolved Then
myItem.Subject = "Prepare Agenda For Meeting"
myItem.DueDate = Now + 30
myItem.Display
myItem.Send
End If
End Sub

I do have the Microsoft Outlook 14.0 Object Library referenced and I got a clean compile prior to running the code.

When I select the intended recipients name, I get a "Run-Time Error "287" Application-Defined or Object-Defined Error"

When I debug the code, the portion in red is the culprit.

I found a similar thread on here that had over 65 responses and everything was suggested up to and including human sacrifices. However, there was no resolution or "eureka" moment that I could see.

Open to any and all suggestions, up to and including human sacrifice...
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 11:40
Joined
Feb 28, 2001
Messages
27,317
I have no great words of wisdom here, but when I was dinking around with Outlook I started to get this error. The articles I found suggested that I look at the variable that I was trying to set (using the locals window) to see if it got defined anyway (even though the error popped up). In my case, I found that it did create a definition, so my error trap routine now includes

Code:
    If Err.Number = 287 Then
        Resume Next
    End If

It seems to work OK. I believe this error popped up when I was adding something to one of Outlook's collections, but the truth is that it happened so long ago that I don't recall the exact details. All I know is that the code seems to work if I ignore the 287.

If you wanted to verify IN CODE that you actually defined something, you could follow the offending line with an "IF MyDelegate Is Nothing Then GoTo OhCrud" - or something like that. If you fall through that If statement, then MyDelegate got defined.
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 12:40
Joined
Apr 27, 2015
Messages
6,396
Hello there Doc, I was beginning to think I had asked the million dollar question here or had won "Stump the Chump".

I have googled this to the highest level of googletivity today and although I have NOT found an answer, I did come across some insight.

Within Outlook, when you assign a task, you do not actually assign a task directly in someones's task list. What happens is you send that person a REQUEST to accept the task. I will alter my searching with that concept in mind to see if a "eureka" moment is forthcoming.

But right now, I am on my 2nd beer and my Give_A_Damn is not calibrated to the proper setting. I will take up the cause once that changes and let you know how I fare.

Always good to hear from you...
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 12:40
Joined
Apr 27, 2015
Messages
6,396
Well...I took this project home and ran it on my computer with Office 2016: It worked without a hitch.

So...I broke out my laptop that still has Office 2010 and it also works. The code is good. I cant really determine if it is local settings or the OS - We use Win 7 at work but my Laptop has Win 10. And...just to make things even more interesting, the machine I have Office 2016 on uses Win 7.

At least I know the code is sound and I can look elsewhere...
 

Users who are viewing this thread

Top Bottom