Results 1 to 2 of 2

Thread: [RESOLVED] vb 6 send email with attachment

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2013
    Location
    Earth
    Posts
    36

    Resolved [RESOLVED] vb 6 send email with attachment

    I am trying to write a program that will send email with an attachment in VB6.I'm using cdo but it doesn't work please help me thanks in advance.

    I'm getting an error in this line -cdo_msg.Send-

    Private Sub cmdSend_Click()
    Dim cdo_msg As Object

    Set cdo_msg = CreateObject("CDO.Message")

    cdo_msg.Subject = txtSubject.Text
    cdo_msg.From = txtFrom.Text
    If Len(txtTo.Text) > 0 Then cdo_msg.To = txtTo.Text
    If Len(txtCc.Text) > 0 Then cdo_msg.Cc = txtCc.Text
    If Len(txtBcc.Text) > 0 Then cdo_msg.Bcc = txtBcc.Text
    If Len(txtAttachment.Text) > 0 Then
    cdo_msg.AddAttachment txtAttachment.Text
    End If
    cdo_msg.TextBody = txtBody.Text

    cdo_msg.Send
    Set cdo_msg = Nothing

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vb 6 send email with attachment

    is txtAttachment.Text a full path to file?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width