• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

error '13 ' en tiempo de ejecución. No coinciden los tipos

Mauricio Ospina

New Member
Good afternoon everybody. I have the following macro but I can't make it work. I tried sending a mail without attachments and it works fine, but when I add the line:
Code:
Mail.Attachments.Add "C:\Users\mospi\Desktop\UVALDO.PDF"
it throws the related error. I'd be very grateful if anybody can help me with this.

Muy buenas a todos. Tengo el siguiente macro pero no logro que funcione. Hice la prueba de enviar un mensaje sin adjuntos (attachments) y funciona bien pero cuando agrego la linea: Mail.Attachments.Add "C:\Users\mospi\Desktop\UVALDO.PDF" arroja el error en mención. SI alguien me puede ayudar con esto, le estaría muy agradecido.

Code:
Private Sub cbtEnvioCorreo_Click()

Dim Mail As New Message

   Dim Config As Configuration: Set Config = Mail.Configuration

   Config(cdoSendUsingMethod) = cdoSendUsingPort
   Config(cdoSMTPServer) = "smtp.gmail.com"
   Config(cdoSMTPServerPort) = 465
   Config(cdoSMTPAuthenticate) = cdoBasic
   Config(cdoSMTPUseSSL) = True
   Config(cdoSendUserName) = "m.ospina@resma.com.co"
   Config(cdoSendPassword) = "XXXXXX"
   Config.Fields.Update
   With Mail
       .To = "correo@resma.com.co"
       .from = Config(cdoSendUserName)
       .Subject = "Subject from VBA"
       .HTMLBody = "Body 0from VBA"
       .Attachments.Add "C:\Users\mospi\Desktop\UVALDO.PDF"
       .Send
   End With
   MsgBox "Sent"

End Sub

EDITED: Don't post passwords or sensitive data.

EDITED (SirJB7): courtesy translation service... once in a blue moon...
 
Last edited by a moderator:
Back
Top