この vba リモート電子メール送信スクリプトを動作させるのに問題があります。
実行時エラー 429 ActiveX コンポーネントはオブジェクトを作成できません。
Microsoft CDO 1.21 ライブラリをダウンロードし、cdo.dll コマンド プロンプトを管理者として登録し、参照しました。
.dll 場所: C:\Program Files\ExchangeMapi\cdo.dll
OS: Windows 7 Professional、32 ビット、サービス パック 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 バージョンを購入する必要があるのではないかと考えています。どんな助けでも素晴らしいでしょう。ありがとう。