VBA コードを使用して電子メールを送信しようとしています。関数は動作しており、電子メールは送信されますが、問題は、関数の終了時に「実行時エラー 438 オブジェクトはこのプロパティまたはメソッドをサポートしていません」と表示されることです。
コードは次のとおりです。
Public Function SendEmail(ItemName As String, Total_Qnty As Integer)
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
' send one copy with Google SMTP server (with autentication)
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.gmail.com"
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "example@gmail.com"
Flds.Item(schema & "sendpassword") = "*****"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update
With iMsg
.To = "example@hotmail.com"
.From = "example@gmail.com"
.Subject = "Mail from gmail"
.HTMLBody = "The Stock Safty Level of Item: " & ItemName & " is DOWN, The total quantity you have is: " & Total_Qnty & "!!"
Set .Configuration = iConf
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
End Function
任意のアイデアを喜ば..ありがとう