我正在创建一个Outlook会议请求的代码,我希望它发送到被邀请者列表。我可以创建会议请求,但我无法发送。我可以在日历中看到会议请求。我怎样才能发送它?Excel创建Outlook会议请求,无法发送
这里是我的代码:
Sub AddAppointments()
' Create the Outlook session
Set myOutlook = CreateObject("Outlook.Application")
' Start at row 2
r = 2
Do Until Trim(Cells(r, 1).Value) = ""
' Create the AppointmentItem
Set myApt = myOutlook.CreateItem(1)
' Set the appointment properties
myApt.Subject = Cells(r, 1).Value
myApt.Location = Cells(r, 2).Value
myApt.Start = Cells(r, 3).Value
myApt.Duration = Cells(r, 4).Value
myApt.Recipients.Add Cells(r, 8).Value
myApt.MeetingStatus = olMeeting
myApt.ReminderMinutesBeforeStart = 88
myApt.Recipients.ResolveAll
myApt.AllDayEvent = AllDay
' If Busy Status is not specified, default to 2 (Busy)
If Trim(Cells(r, 5).Value) = "" Then
myApt.BusyStatus = 2
Else
myApt.BusyStatus = Cells(r, 5).Value
End If
If Cells(r, 6).Value > 0 Then
myApt.ReminderSet = True
myApt.ReminderMinutesBeforeStart = Cells(r, 6).Value
Else
myApt.ReminderSet = False
End If
myApt.Body = Cells(r, 7).Value
myApt.Save
r = r + 1
myApt.Send
Loop
End Sub
会发生什么事,当你运行该代码?任何错误,Outlook安全警告等? – brettdj
我没有收到任何错误。问题在于会议请求未发送出Outlook – user1056087
您是否检查了所需的参考? (我认为如果没有的话你会有一个错误)你是否在代码的开头(在第一个'Sub'之前)添加了一个'Option Explicit'?如果你仍然没有提出任何错误,试着用硬编码值来执行你的代码的某些部分,特别是什么不起作用(例如发送你的约会) – JMax