使用VBA脚本从MS Project Tasks创建Outlook约会

时间:2013-07-25 23:43:24

标签: vba outlook export ms-project appointment

仅限于使用VBA脚本,但遇到此问题。

尝试在Outlook中创建约会(弹出式发送,不自动保存)。使用Outlook 2010& MS Project 2013。

复制了我发现的另一个脚本,但它不会运行。将myOLApp调整为Object但我不知道使约会打开的代码;我哪里出错?

非常感谢任何帮助!!

Option Explicit

Public myOLApp As Object


Sub Export_Selection_to_OL_Appointments_AutoEmail()
Dim myTask As Task
Dim myDelegate As Object
Dim myItem As Outlook.App

On Error Resume Next
Set myOLApp = CreateObject("Outlook.Application")
For Each myTask In ActiveSelection.Tasks
Set myItem = myOLApp.CreateItem(olAppointmentItem)
myItem.Assign
With myItem
Set myDelegate = myItem.Recipients.Add(myTask.Resources(1). _
EMailAddress)
myDelegate.Resolve
.Start = myTask.Start
.End = myTask.Finish
.Subject = myTask.Name & " (Project Task)"
.Location = "Informatika v GM"
.Categories = myTask.Project
.Body = myTask.Notes
.Display
.Send
End With
Next myTask
End Sub

0 个答案:

没有答案