vba - 我收到运行时错误“429”。试图让 Excel 宏发送电子邮件
问题描述
Sub SendEmail()
' SendEmail Macro
'
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = ""
olMail.CC = ""
olMail.Subject = " There is a change to the EMR adjustment Form that Approval"
olMail.Send
End Sub
解决方案
你混淆了早期和晚期绑定,
后期绑定使用 Visual BasicGetObject
函数或CreateObject
初始化 Outlook 的函数
例子
Dim olApp as Object Set olApp = CreateObject("Outlook.Application")
要使用早期绑定,首先需要设置对 Outlook 对象库的引用,Microsoft Outlook xx.x 对象库
例子
Dim olApp as Outlook.Application Set olApp = New Outlook.Application
推荐阅读
- python - Pandas:如何仅删除列末尾的最后一个连字符
- google-forms - 如何根据其他用户过去的回复使 Google 表单自动填充?
- c - 我知道一个地址,但我应该如何判断在哪个部分?使用C的全局区域或堆区域或堆栈区域
- json - 如何解决“手势 RangeError(索引)捕获的异常:无效值:有效值范围为空:0”
- c++ - 什么会使多边形算法中的点仅在正向和反向运行时才能正常工作?
- php - PHP:如何使用键->值对每两个分隔符将一个字符串分解为一个数组
- kubernetes - 将 GKE 集群拆除为“全新”状态而不删除它?
- scala - Spark——自定义reduce函数保存到磁盘然后上传到s3
- javascript - XMLHttpRequest 返回事件对象而不是实际数据
- fortran - Fortran 将未知大小的文件读入数组