NauticalGent
Ignore List Poster Boy
- Local time
- Today, 12:05
- Joined
- Apr 27, 2015
- Messages
- 6,752
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("someone@domain.com")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 had posted this with a different title last week; one of the Heavy-Hitters on this forum weighed in a little but didn't really have any words of wisdom (very rare occurrence for this member!)…
However &”, “&PauseForEffect() - he did offer a suggestion that has caused my confusion factor to increase by .7%
I added the line "On Error Resume Next" just to see what would happen.
Everything works as it should; An Outlook Task displays with all the elements populated EXCEPT the “To”(Recipients)
So with that, I conclude that
- The code is correct
- All required references are loaded
- It MUST be local Access or Outlook settings that will not allow me to load a Recipient
One other thing to note is that I took this code home and ran it on my platforms at home. And although I cannot completely duplicate the Access version and OS (Access 2016/Win7 , Access 2010/Win10), both systems run this code with no hiccups.
Can anyone offer some insight/advice on this?
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("someone@domain.com")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 had posted this with a different title last week; one of the Heavy-Hitters on this forum weighed in a little but didn't really have any words of wisdom (very rare occurrence for this member!)…
However &”, “&PauseForEffect() - he did offer a suggestion that has caused my confusion factor to increase by .7%
I added the line "On Error Resume Next" just to see what would happen.
Everything works as it should; An Outlook Task displays with all the elements populated EXCEPT the “To”(Recipients)
So with that, I conclude that
- The code is correct
- All required references are loaded
- It MUST be local Access or Outlook settings that will not allow me to load a Recipient
One other thing to note is that I took this code home and ran it on my platforms at home. And although I cannot completely duplicate the Access version and OS (Access 2016/Win7 , Access 2010/Win10), both systems run this code with no hiccups.
Can anyone offer some insight/advice on this?