gpt4 book ai didi

vba - 如何在 Outlook.AppointmentItem 中设置收件人属性?

转载 作者:行者123 更新时间:2023-12-04 04:36:56 24 4
gpt4 key购买 nike

在这个 excel VBA 代码中,我正在尝试在 Outlook 中创建一个新约会,我想要通过电子邮件发送该约会,即我想邀请用户进行约会。
我不确定我是否需要为这个东西创建一个新的 outlook.recipients 对象,或者我没有正确使用 .Recipeint.Add 属性。

Sub app()

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.AppointmentItem

Set OutApp = New Outlook.Application
Set OutMail = OutApp.CreateItem(olAppointmentItem)

With OutMail

.Location = " happening"
.Subject = " Event check "
.Start = "8:00 PM" & Format(Date)
.End = "9:00 PM" & Format(Date)
.Body = "this is event details"
.Recipients.Add ("someone@gmail.com") ' This line is not working
' .Display
.Send

End With

End Sub

我将应用程序定义或对象定义为错误。
提前致谢。

最佳答案

约会是个人的,仅供您使用。

您必须先将其更改为 session ,然后才能添加收件人。

为此,请添加 AppointmentItem.MeetingStatus = olMeeting到你的代码。因此,对于您的代码,它将是

Sub app()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.AppointmentItem

Set OutApp = New Outlook.Application
Set OutMail = OutApp.CreateItem(olAppointmentItem)

With OutMail
.MeetingStatus = olMeeting
.Location = " happening"
.Subject = " Event check "
.Start = "8:00 PM" & Format(Date)
.End = "9:00 PM" & Format(Date)
.Body = "this is event details"
.Recipients.Add ("someone@gmail.com") ' This line is not working
' .Display
.Send

End With
End Sub

关于vba - 如何在 Outlook.AppointmentItem 中设置收件人属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19595434/

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