1 Reply Latest reply: Oct 1, 2013 7:37 AM by vikas mahajan RSS

    Send mail with attached file (Macro VB)

      HI,

      I want to send mail from a boutton in QV with attached file. I create a macro but I have an error msg " Un composant ActiveX ne peut pas créer un objet: 'CDO.Message'".!! I use outlook to send mail.

       

      this is the macro:

       

      sub Send()

      Set objMessage = CreateObject("CDO.Message")

      set objConf = CreateObject("CDO.Configuration")

       

      objMessage.Subject = "Tester l'envoi    "

      objMessage.From = "admin@adress.com"

      objMessage.To = "myadress@me.com"

      objMessage.TextBody = "This is a test message text."

       

       

      '==This section provides the configuration information for the remote SMTP server.

      '==Normally you will only change the server name or IP.

      objMessage.Configuration.Fields.Item _

      ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

       

      'Name or IP of Remote SMTP Server

      objMessage.Configuration.Fields.Item _

      ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.me.com"

       

      'Server port (typically 25)

      objMessage.Configuration.Fields.Item _

      ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

       

      objMessage.Configuration.Fields.Update

       

      '==End remote SMTP server configuration section==

       

      objMessage.Send

      end sub