首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VBA CDO运行时错误429

VBA CDO运行时错误429
EN

Stack Overflow用户
提问于 2013-09-06 05:03:00
回答 1查看 1.4K关注 0票数 0

使此vba远程电子邮件发送脚本正常工作时出现问题。

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

我已经下载了MicrosoftCDO1.21库,将cdo.dll命令提示符注册为管理员,并引用了它。

程序位置:C:\ .dll Files\ExchangeMapi\cdo.dll

操作系统: Windows 7专业版,32位,Service Pack 1。

基于VBA的Iconics ScriptWorx32应用程序

代码:

代码语言:javascript
复制
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类实例化模块,所以你已经购买了他们的软件图形用户界面版本。任何帮助都是最好的。谢谢。

EN

回答 1

Stack Overflow用户

发布于 2013-09-09 07:07:27

我通过使用一个不同的库解决了这个问题: cdosys.dll而不是cdo.dll,参考: Microsoft CDO For Windows2000 Library。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18645917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档