Results 1 to 3 of 3

Thread: Mapi (vb6)

  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mapi (vb6)

    Hello

    I'm trying with the code below to attach pictures from items selected from a listbox (lstImages) in the "msgNoteText" section of the mail, so the recipient see's the images within the mail.
    (tried something similar in Access not so long ago, this is a different project)
    Just struggling withe the code.
    Can someone help here.?

    <pre>Private Sub Command2_Click()
    On Error GoTo ErrHandler
    Dim i As Long
    Dim lngAttIndex As Long
    Dim intindex As Integer

    lngAttIndex = 0

    If Me.lstImages.ListCount = 0 Then
    MsgBox "No Items Selected For Mailing", vbInformation, "Information"
    Else
    'Logon & Sync
    MAPISession1.SignOn
    'Create Message w/Attachments then Send
    With MAPIMessages1
    .SessionID = MAPISession1.SessionID
    .Compose
    .MsgSubject = "Files From " & CompName

    For i = 0 To Me.lstImages.ListCount - 1
    'Assign Index
    .AttachmentIndex = lngAttIndex
    .AttachmentPosition = lngAttIndex
    ' Increase index for next one
    lngAttIndex = lngAttIndex + 1
    .AttachmentPathName = Me.lstImages.List(i)
    .MsgNoteText = _
    Space(lstImages.ListCount).AttachmentPathName
    Next i
    .Send True
    End With

    End If
    exitHandler:
    'On Error Resume Next
    MAPISession1.SignOff
    Me.lstImages.Clear
    Exit Sub

    ErrHandler:
    If Err = 32002 Then
    WriteLog GetComputerName & " " & GetNetUser & " Error "
    MsgBox "An error occurred " & vbCrLf & _
    "It is advised that you re-boot your PC and try again." & vbCrLf & _
    "No files have been harmed on your computer" & vbCrLf & _
    "This is only a pre-cautionary measure", vbInformation, "Error"
    End If
    Resume exitHandler

    End Sub</pre>


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Mapi (vb6)

    MapiMessages doesn't support inserting a picture in the body of an e-mail. See To add an embedded image to an HTML message in Microsoft Outlook using code for an example using the Outlook and CDO object libraries. Not trivial stuff!

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mapi (vb6)

    Thanks Hans, I'll have a look.

Posting Permissions

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