[英]ActiveX Component can't create object for Outlook VBA
我正在嘗試運行宏以通過 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 = "ron@debruin.nl"
.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")
,它給出了一個錯誤:
runtime error '429': ActiveX Component can't create object.
我在cmd中運行了這一行:
regsvr32 /i "c:\windows\system32\outlvba.dll".
然后它給了我這個錯誤:
The module "c:\windows\system32\outlvba.dll" failed to load.
Make sure the binary is stored at the specified path or debug it to check
for problems with the binary or dependent .DLL files. The specified
module could not be found.
在這方面需要一些指導。
您是否在有問題的 PC 上安裝了 Click2Run 版本的 Office?
Office 2010 的 Click2Run 版本不支持自動化。 有關詳細信息,請參閱Office 2010 與加載項的即點即用兼容性。 您還可以找到如何:驗證 Outlook 是否是計算機上的即點即用應用程序一文。
有關詳細信息,請參閱自動化 Office 應用程序時收到運行時錯誤 429 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.