troubleshooting Question

Using the MAPI Controls

Avatar of sheslop
sheslop asked on
Visual Basic Classic
8 Comments1 Solution279 ViewsLast Modified:
im trying to use the MAPI controls to send emails with attachments. if i ever have more than 1 attachment i get the error "attachment not found". i beleive it has something to do with the attachmentindex proprty of the MAPI control.

code below.

For i = 1 To lstEmailFiles.ListItems.count
       
        With MAPIMessages1
            .SessionID = MAPISession1.SessionID
            .Compose
            .RecipAddress = Trim$(lstEmailFiles.ListItems(i).Text)
            .RecipType = mapToList
            .MsgSubject = txtEmailSubject
            .MsgNoteText = txtEmailMessage
            j = 1
            Do While lstEmailFiles.ListItems(i).SubItems(j) <> ""
                .AttachmentPathName = lblOutputDir & "\" & lstEmailFiles.ListItems(i).SubItems(j)
                .AttachmentType = mapData
                .AttachmentIndex = j - 1
                j = j + 1
            Loop
            .ResolveName
            .Save
            MsgBox (.AttachmentIndex)
            .Send False
        End With
    Next

any help greatly appreciated.
ASKER CERTIFIED SOLUTION
rpai

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros