.Location =" TBD" '.Recipients.Add(myTask.ResourceNames) .OptionalAttendees = Replace(myTask.ResourceNames,", ",";") 。保存 。会员状态= 1 .ResponseRequested = True 。移动myDestFolder 。发送  结束与 如果不(myTask Is Nothing)然后 myTask.Date1 = myTask.Start myTask.Date2 = myTask.Finish myTask.Text25 =" ;约会< b $ b结束如果  下一个myTask x = MsgBox("所有选定的任务导出到资源Outlo ok日历作为约会",vbOKOnly," Export Completed")= vbOK Application.Calculation = pjAutomatic Application.ScreenUpdating = True 结束次 Ofir Marco,MCTS PZ项目解决方案 您好, 我正在处理一些导出Microsoft Project Task的VBA宏数据进入新的约会(在展望日历上)。 它向添加的收件人发送约会,并将其作为组织者保存在用户的日历上。 有些用户会将很多任务导出为约会,但他们不希望它填写默认日历。 所以我试图找到一种方法将其添加到非默认日历。 我添加了日历名称"MSP"。下面的"我的日历"夹。 (我使用的是Outlook 2016,但如果重要的话,公司的一些用户正在使用outlook 2010) 我尝试了一些方法来查找日历并将会议添加到其中但是它始终将其置于默认值。   下面我正在添加VBA代码,没有我尝试过的,如果你可以帮我找到或建议我应该添加什么或者使用什么代码行来实现它第二个日历非常感谢。 基本上我需要的是: 检查用户是否有另一个日历命名为"MSP"如果没有,则创建它。 一旦用户具有该日历,它应该将约会添加到"MSP"。日历。 请忽略Call ReplaceAppointments行,如果日期已更改,则调用覆盖现有约会的程序。  您也可以忽略反映MS Project更改的代码行,只需考虑Outlook行。 我的代码:&NBSP; &NBSP;      &NBSP; &NBSP;                    Sub Export_Selection_To_Resources_OL_Calendar_Appointments_From_Other_Account() Dim myOLApp As Outlook.Application Dim myTask As Task Dim myItem As Outlook.AppointmentItem Dim x As Integer Dim oAccount As Outlook.Account Dim Ns As Outlook.NameSpace Dim myDestFolder As Outlook .Fold Application.Calculation = pjManual Application.ScreenUpdating = False On Error Resume Next 设置myOLApp = CreateObject(" Outlook.Application")  设置Ns = Application.GetNamespace(" MAPI") 每个myTask在ActiveSelection.Tasks中使用设置myItem = myOLApp.CreateItem(olAppointmentItem)  使用myItem   '替换现有的预约  调用ReplaceAppointments(myTask.OutlineParent.OutlineParent.Name&">>"& myTask.OutlineParent.Name&">>"& myTask.Name&"(Project Task) ")   &NBSP; &NBSP; .Start = myTask.Start   &NBSP; &NBSP; .End = myTask.Finish   &NBSP; &NBSP; .Subject = myTask.OutlineParent.OutlineParent.Name& " >> " &安培; myTask.OutlineParent.Name& " >> " &安培; myTask.Name& " (项目任务)" b   &NBSP; &NBSP; .Categories =" Exported"   &NBSP; &NBSP; .Body = myTask.Notes   &NBSP; &NBSP; .BusyStatus = olFree   &NBSP; &NBSP; .Location =" TBD"   &NBSP; '  .Recipients.Add(myTask.ResourceNames)   &NBSP; &NBSP;   .OptionalAttendees = Replace(myTask.ResourceNames,",",";")   &NBSP; &NBSP;  。保存¥b $ b  &NBSP; &NBSP; .MeetingStatus = 1   &NBSP; &NBSP; .ResponseRequested = True 。移动myDestFolder   &NBSP;  。发送   结束与$   &NBSP;如果不是(myTask Is Nothing)则为  &NBSP; &NBSP; &NBSP; myTask.Date1 = myTask.Start   &NBSP; &NBSP; &NBSP; myTask.Date2 = myTask.Finish   &NBSP; &NBSP; &NBSP; myTask.Text25 ="约会"   &NBSP;结束如果  下一页myTask   &NBSP; x = MsgBox("导出到资源的所有选定任务Outlook日历作为约会",vbOKOnly,"导出已完成")= vbOK   Application.Calculation = pjAutomatic   Application.ScreenUpdating = True End Sub Hello,I am working on some VBA macros that exports Microsoft Project Task's data into a new appointment (on outlook calendar).It sends an appointment to the added recipients and keeps it on the user's calendar as the organizer.Some users will export a lot of tasks as appointments but they will not want it to fill in their default calendar.So i am trying to find a way to add it to a non default calendar.i have added a calendar names "MSP" below "My calendars" folder. (i am using outlook 2016 but some of the users in the company are using outlook 2010 if it matters)i tried a few methods to locate the calendar and add the meeting into it but it always places it in the default one. Below i am adding the VBA code, without what i have tried, if you can help me find or suggest what i should add or what code lines to use to have it on the second calendar it would be very appreciated.Basically what i need is:Check if the user has another calendar named "MSP" if not, create it.once the user has that calendar it should add the appointment to the "MSP" calendar.Please ignore the Call ReplaceAppointments line, it is calling a procedure that overrides an existing appointment if dates were changed. You can also ignore the code lines that are reflecting MS Project changes, just mind the outlook lines.My Code: Sub Export_Selection_To_Resources_OL_Calendar_Appointments_From_Other_Account()Dim myOLApp As Outlook.ApplicationDim myTask As TaskDim myItem As Outlook.AppointmentItemDim x As IntegerDim oAccount As Outlook.AccountDim Ns As Outlook.NameSpaceDim myDestFolder As Outlook.FolderApplication.Calculation = pjManualApplication.ScreenUpdating = FalseOn Error Resume NextSet myOLApp = CreateObject("Outlook.Application") Set Ns = Application.GetNamespace("MAPI")For Each myTask In ActiveSelection.TasksSet myItem = myOLApp.CreateItem(olAppointmentItem)With myItem' Replace existing appointmentCall ReplaceAppointments(myTask.OutlineParent.OutlineParent.Name & " >> " & myTask.OutlineParent.Name & " >> " & myTask.Name & " (Project Task)").Start = myTask.Start.End = myTask.Finish.Subject = myTask.OutlineParent.OutlineParent.Name & " >> " & myTask.OutlineParent.Name & " >> " & myTask.Name & " (Project Task)".Categories = "Exported".Body = myTask.Notes.BusyStatus = olFree.Location = "TBD"' .Recipients.Add (myTask.ResourceNames).OptionalAttendees = Replace(myTask.ResourceNames, ",", ";").Save.MeetingStatus = 1.ResponseRequested = True.Move myDestFolder.Send End WithIf Not (myTask Is Nothing) ThenmyTask.Date1 = myTask.StartmyTask.Date2 = myTask.FinishmyTask.Text25 = "Appointment"End If Next myTaskx = MsgBox("All selected tasks exported to resources Outlook Calendar as appointments", vbOKOnly, "Export Completed") = vbOKApplication.Calculation = pjAutomaticApplication.ScreenUpdating = TrueEnd SubOfir Marco , MCTS P.Z. Projects 解决方案 Hello,I am working on some VBA macros that exports Microsoft Project Task's data into a new appointment (on outlook calendar).It sends an appointment to the added recipients and keeps it on the user's calendar as the organizer.Some users will export a lot of tasks as appointments but they will not want it to fill in their default calendar.So i am trying to find a way to add it to a non default calendar.i have added a calendar names "MSP" below "My calendars" folder.(i am using outlook 2016 but some of the users in the company are using outlook 2010 if it matters)i tried a few methods to locate the calendar and add the meeting into it but it always places it in the default one.  Below i am adding the VBA code, without what i have tried, if you can help me find or suggest what i should add or what code lines to use to have it on the second calendar it would be very appreciated.Basically what i need is:Check if the user has another calendar named "MSP" if not, create it.once the user has that calendar it should add the appointment to the "MSP" calendar.Please ignore the Call ReplaceAppointments line, it is calling a procedure that overrides an existing appointment if dates were changed. You can also ignore the code lines that are reflecting MS Project changes, just mind the outlook lines.My Code:                         Sub Export_Selection_To_Resources_OL_Calendar_Appointments_From_Other_Account()Dim myOLApp As Outlook.ApplicationDim myTask As TaskDim myItem As Outlook.AppointmentItemDim x As IntegerDim oAccount As Outlook.AccountDim Ns As Outlook.NameSpaceDim myDestFolder As Outlook.FolderApplication.Calculation = pjManualApplication.ScreenUpdating = FalseOn Error Resume NextSet myOLApp = CreateObject("Outlook.Application")  Set Ns = Application.GetNamespace("MAPI")For Each myTask In ActiveSelection.TasksSet myItem = myOLApp.CreateItem(olAppointmentItem) With myItem  ' Replace existing appointment  Call ReplaceAppointments(myTask.OutlineParent.OutlineParent.Name & " >> " & myTask.OutlineParent.Name & " >> " & myTask.Name & " (Project Task)")      .Start = myTask.Start      .End = myTask.Finish      .Subject = myTask.OutlineParent.OutlineParent.Name & " >> " & myTask.OutlineParent.Name & " >> " & myTask.Name & " (Project Task)"      .Categories = "Exported"      .Body = myTask.Notes      .BusyStatus = olFree      .Location = "TBD"    '   .Recipients.Add (myTask.ResourceNames)       .OptionalAttendees = Replace(myTask.ResourceNames, ",", ";")       .Save      .MeetingStatus = 1      .ResponseRequested = True.Move myDestFolder     .Send   End With    If Not (myTask Is Nothing) Then        myTask.Date1 = myTask.Start        myTask.Date2 = myTask.Finish        myTask.Text25 = "Appointment"    End If Next myTask    x = MsgBox("All selected tasks exported to resources Outlook Calendar as appointments", vbOKOnly, "Export Completed") = vbOK Application.Calculation = pjAutomatic Application.ScreenUpdating = TrueEnd Sub 这篇关于创建约会(从MS Project)到非默认的Outlook日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-08 12:19