0
我正在通過Excel分配Outlook任務。由於我沒有保存任務的副本,因此警報顯示該任務不會被保存並詢問我是否想要發送任務。當發送任務但不保留副本時禁用警報
我一直在使用Sendkeys(我知道,這不是一個好方法)。它在我的電腦上工作,但不在我的一些同事的電腦上工作。
是否可以停用這些警報?
這裏是我的代碼:
Sub SendMail(dest As String, Echeance As String)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim i As Integer
Dim nom As String
Dim compte As Integer
Dim myOlApp As Outlook.Application
Dim myItem As Outlook.TaskItem
Dim myDelegate As Outlook.Recipient
Set myOlApp = New Outlook.Application
For i = 1 To myOlApp.Session.Folders.Count
If myOlApp.Session.Folders.Item(i) = "_F_VTG-LBA ALCG-RAVEVAC" Then
compte = i
Exit For
End If
Next i
Set myItem = myOlApp.Session.Folders.Item(compte).Items.Add(olTaskItem)
myItem.Assign
Set myDelegate = myItem.Recipients.Add(dest)
myDelegate.Resolve
If myDelegate.Resolved Then
myItem.Subject = Task.titre
myItem.Body = Task.Mess
myItem.DueDate = Echeance
myItem.StartDate = Now
myItem.ReminderTime = True 'Rappel
myItem.Display
Application.DisplayAlerts = False
myItem.Send
'Or
Application.Wait (Now + TimeValue("0:00:03"))
Application.SendKeys "^~" 'presses send as a send key
Application.Wait (Now + TimeValue("0:00:03"))
SendKeys "TAB", True
SendKeys "{ENTER}", True
i = 0
End If
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
你有'Application.DisplayAlerts = False'兩次? – 0m3r