我正在通过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
答案 0 :(得分:0)
如果您不想在自己的列表中执行任务,请分配正常方式然后删除。
myItem.Display ' Do not uncheck the box
myItem.Send
myItem.Delete