outlook - 在 Windows 10 上使用 VB6 错误通过 Outlook 发送电子邮件:运行时 287 - 应用程序定义或对象定义错误
问题描述
我们在 Windows 7 和 Windows 10 上运行旧的 Visual Basic 6 应用程序。
其中一项功能是通过 Outlook 桌面客户端发送外发电子邮件。
适用于 Windows 7 机器的相同应用程序不适用于 Windows 10 PC。在 Windows 10 PC 上不发送电子邮件。
Public Sub SendOlMail(Subject As String, attachment As String, Recipient As String, bodytext As String)
Const olMailItem = 0
Dim objOutl As Object
Dim objMailItem As Object
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
objMailItem.Recipients.Add Recipient
objMailItem.Subject = Subject
objMailItem.Body = bodytext
objMailItem.Attachments.Add attachment
objMailItem.Send
Set objMailItem = Nothing
Set objOutl = Nothing
End Sub
删除后On Error Resume Next
,我在 Windows 10 PC 上收到错误消息。
运行时 287 - 应用程序定义或对象定义的错误
我发现错误在线objMailItem.Recipients.Add Recipient
,并且看起来像是在 Windows 10 PC 中遗漏了一些东西。
尝试以管理员身份运行该应用程序,但仍然无法正常工作。
解决方案
推荐阅读
- python - 使用来自 scipy.integrated at python 的 Radau 方法求解中子动力学方程
- r - 从 R 中的列中删除非唯一的字符串组件
- java - Gradle:无法生成 QueryDSL 类
- sql - 如果列是字母数字,则在 sql 查询中获取列中的最大值
- javascript - 如何在 Gatsby 博客的侧边栏上创建每月存档列表?
- mysql - 如何在 MySQL Workbench 中使用 REGEXP_SUBSTR 或 REGEXP_EXTRACT 以及托管在 Google Cloud SQL 上的数据库?
- x++ - 将数据从 Dynamics AX 中的单个表单保存到不同的表
- github - 为什么我的 github 存储库有 17 个独特的克隆器?
- c# - 使用 SQL 插入 XML 元素
- batch-file - 批量复制字符