我正在創建一個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