excel - 引用 Outlook VBA 中的 Excel 单元格的应用程序定义或对象定义错误

标签 excel outlook vba

下面是我编写的用于自动发送 session 邀请的代码。

代码从工作表中的单元格中选择内容:Final_List。

当我尝试从 Excel 获取收件人地址时,我已突出显示出现错误的位置

Application -defined or object - defined error.


Dim outlookApp As Outlook.Application
Dim outlookmeet As AppointmentItem
Dim myRequiredAttendee As Recipient

Dim sh As Worksheet
Dim RowCount As Long

RowCount = 2
'row 1 has headers

With Worksheets("Final_List")

    Do While IsEmpty(Cells(RowCount, 1).Value) = False

        Set outlookApp = CreateObject("Outlook.Application")
        Set outlookmeet = outlookApp.CreateItem(olAppointmentItem)
        With outlookmeet

            .MeetingStatus = olMeeting

            .Subject = Cells(RowCount, 1).Value & " - " & Cells(RowCount, 2).Value
            .Location = Cells(RowCount, 3).Value
            .Start = Cells(RowCount, 5).Value
            .Duration = Cells(RowCount, 7).Value

            'getting errors on this line                     
            .Recipients.Add (Cells(RowCount, 6).Value)

            .Recipients.ResolveAll

            .Body = Cells(RowCount, 4).Value
            .Send
        End With

        RowCount = RowCount + 1

    Loop
End With

Set outlookmeet = Nothing
Set outlookApp = Nothing
MsgBox "All invites sent!"

最佳答案

AppointmentItem 对象没有 Recipient 属性。 Compare MSDN library

关于excel - 引用 Outlook VBA 中的 Excel 单元格的应用程序定义或对象定义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46419137/

相关文章:

excel - 检测单元格中超过 5 个字符的宏(邮政编码)

python - 如何更正导致列集中出现 "shifted"数据的缺失单元格/缺失分隔符?

循环通过宏调用的 Excel 2013 宏仅适用于一张工作表

ms-access - ms access 获取从 FileDialog 中选择的文件名

excel - 使用 Outlook 模板和设置变量从 Excel 2007 VBA 发送电子邮件

excel - 扫描非默认 Outlook 收件箱中的电子邮件?

xml - 使用 VBA 将 Access 表导出为 XML

vba - 拦截共享工作簿上的 "Paste"事件并运行宏

excel - 在 VBA 中引用 Windows 可移植设备文件时遇到问题?

excel - Outlook 中的电子邮件地址格式(EX 而不是 SMTP)