|
-
Jun 21st, 2000, 02:08 AM
#1
Thread Starter
Junior Member
HELP!
Could you pls tell me how i can send a msg with
several attachments? i've tried but i get an error msg
sending the second file.
This is my code:
Set objMapi = CreateObject("MAPI.Session")
If Not objMapi Is Nothing Then
objMapi.Logon profilename:=sProfile
End If
Set objMsg = objMapi.Inbox.Messages.Add
objMsg.Subject = sSubject
objMsg.Text = sMsg
'Sending files
If Not IsMissing(sFiles) Then
sFile = Split(sFiles, ";")
For i = LBound(sFile) To UBound(sFile)
Set objAttach = objMsg.Attachments.Add
With objAttach
'THIS IS WHERE I GET THE ERROR WHEN IT HAD'S THE SECOND FILE: (i=2)
.Source = sFile(i)
.Type = mapiFileData
.ReadFromFile sFile(i)
End With
Next i
End If
If you have any clue why this happens pls
reply.
thank you!
-
Jun 30th, 2000, 11:53 AM
#2
I hope it'll be helpful. It attaches as many files as you want. In my code the files are in a listbox.
' attach all selected files from the list
AttachmentFile = lstAttachment.List(count)
If AttachmentFile > "" Then
For count = 0 To lstAttachment.ListCount - 1
.AttachmentIndex = nIndex
.AttachmentPathName = AttachmentFile
.AttachmentPosition = nIndex
nIndex = nIndex + 1
Next count
Else
.Delete (2)
End If
.Send
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|