gpt4 book ai didi

vba - 如何等到发送电子邮件并在 Outlook VBA 中关闭窗口?

转载 作者:行者123 更新时间:2023-12-04 14:41:42 25 4
gpt4 key购买 nike

我的 VBA 代码打开一个电子邮件模板,在编辑和发送电子邮件后,应将电子邮件内容复制到约会中。

问题是约会在发送电子邮件之前打开,未编辑的电子邮件内容被插入到约会中。 (如果我删除 while 循环)

如何等待发送电子邮件并关闭其窗口?

错误:Outlook 卡住或显示错误:

runtime error '-2147221238 (8004010a)': element moved....


Public Sub Fooo()
Dim items As Outlook.items
Dim Item As Object

Set items = Application.ActiveExplorer.CurrentFolder.items

Set Item = items.Add("IPM.Note.My Template Mail")
Item.SentOnBehalfOfName = "foo@bar.com"
Item.Display

While Item.Sent = False
Wend

CreateAppointment MyMail:=Item

End Sub

最佳答案

等待 Items.ItemAdd 事件在 Sent Items 文件夹上触发,然后才创建新约会。

关于vba - 如何等到发送电子邮件并在 Outlook VBA 中关闭窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42065281/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com