使此 vba 远程电子邮件发送脚本正常工作时遇到问题。
运行时错误 429 ActiveX 组件无法创建对象。
我已经下载了 Microsoft CDO 1.21 库,将 cdo.dll cmd 提示符注册为管理员,并引用了它。
.dll 位置:C:\Program Files\ExchangeMapi\cdo.dll
操作系统:Windows 7 Professional,32 位,Service Pack 1。
使用 VBA 的应用程序:Iconics ScriptWorx32
代码:
Public Sub SendEmail(nFrom As String, nSubject As String, nOutGoingServer As String, _
nMessage As String, nPassword As String, nUserName As String, _
nServerPort As Long, nTo As String, Optional nIntProxyPort As Long)
Dim Msg As Object
Dim Confg As Object
Dim Flds As Variant
Set Msg = CreateObject("CDO.Message")
Set Confg = CreateObject("CDO.Configuration")
Confg.Load -1
Set Flds = Confg.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = nUserName
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = nPassword
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = nOutGoingServer
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = nServerPort
' If using internet proxy
.Item("http://schemas.microsoft.com/cdo/configuration/urlproxyserver") = nIntProxyPort
.Update
End With
nMessage = nMessage & vbNewLine & vbNewLine & _
"THIS IS AN AUTOMATED REPSONSE FROM ADMIN"
With Msg
Set .Configuration = Confg
.To = nTo
.From = nFrom
.Subject = nSubject
.TextBody = nMessage
.Send
End With
End sub
我想知道这个软件是否内置了某种 cdo.dll 类实例化块,所以你已经购买了他们的软件 GUI 版本。任何帮助都会很棒。谢谢。