ActiveX 组件无法为 Outlook VBA 创建对象

问题描述 投票:0回答:1

我正在尝试通过 Outlook 发送电子邮件。

Sub Mail_small_Text_Outlook()
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
'Working in Office 2000-2013
    Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    strbody = "Hi there" & vbNewLine & vbNewLine & _
              "This is line 1" & vbNewLine & _
              "This is line 2" & vbNewLine & _
              "This is line 3" & vbNewLine & _
              "This is line 4"

    On Error Resume Next
    With OutMail
        .To = "[email protected]"
        .CC = ""
        .BCC = ""
        .Subject = "This is the Subject line"
        .Body = strbody
        'You can add a file like this
        '.Attachments.Add ("C:\test.txt")
        .Send   'or use .Display
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub

在行:

Set OutApp = CreateObject("Outlook.Application")
,它给出了一个错误:

运行时错误“429”:ActiveX 组件无法创建对象。

我在cmd中运行了这一行:

regsvr32 /i "c:\windows\system32\outlvba.dll".

它给了我这个错误:

模块“c:\windows\system32\outlvba.dll”加载失败。
确保二进制文件存储在指定路径或调试以检查
对于二进制或相关 .DLL 文件的问题。指定的
找不到模块。

excel vba outlook excel-2003
1个回答
0
投票

有问题的电脑上是否安装了 Office 的 Click2Run 版本?

Office 2010 的 Click2Run 版本不支持自动化。有关详细信息,请参阅Office 2010 即点即用与加载项的兼容性。您还可以找到如何:验证 Outlook 是否是计算机上的即点即用应用程序一文。

有关详细信息,请参阅自动化 Office 应用程序时收到运行时错误 429。

© www.soinside.com 2019 - 2024. All rights reserved.