VBA CDO Runtime Error 429

1.4k views Asked by At

Having issue getting this vba remote email send script to work.

Run-time error 429 ActiveX component can’t create object.

I've downloaded Microsoft CDO 1.21 Library, registered cdo.dll cmd prompt as Administrator, and referenced it.

.dll Location: C:\Program Files\ExchangeMapi\cdo.dll

OS: Windows 7 Professional, 32 bit, Service Pack 1.

Application with VBA: Iconics ScriptWorx32

Code:

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

I'm wondering if this software built in some sort of cdo.dll class instantiating block so you have buy their software GUI version. Any help would be great. Thanks.

1

There are 1 answers

0
BgreenDSI On

I solved this issue by using a different library: cdosys.dll instead of cdo.dll, reference: Microsoft CDO For Windows 2000 Library.