Guest_imported
New member
- Jan 1, 1970
- 0
When I use VBAMAP32.DLL in my access application for mail I find that I can send only one attachment.
If I make tMessage.FileCount = 1 the message is sent OK with one attachment.
If I make tMessage.FileCount = 2 the message is not sent and I get error 11.
"MAPI Attachment not found".
Here is the code :-
Dim iStatus As Long
Dim gMAPISession As Long
Dim tMessage As MapiMessage
Dim tRecip As MapiRecip
Dim tFiles(2) As MapiFile
'first, logon to MAPI
iStatus = MAPILogon(0&, "", "", MAPI_LOGON_UI, 0&, gMAPISession)
If iStatus <> SUccESS_SUccESS Then
MsgBox MapiErr (iStatus)
Exit Sub
End If
'fill in the structures as needed
tRecip.RecipClass = MAPI_TO
tRecip.Name = "ovajay@usa.net"
tMessage.RecipCount = 1 'one receip
tMessage.FileCount = 2 '2 files
tMessage.Subject = "Test of MAPI"
tMessage.NoteText = Space(2) & vbNewLine & "Hello There"
'set up attachments
tFiles(0).Reserved = 0&
tFiles(0).Flags = 0
tFiles(0).Position = 1
tFiles(0).PathName = "C:\AUTOEXEC.BAT"
tFiles(1).Reserved = 0&
tFiles(1).Flags = 0
tFiles(1).Position = 2
tFiles(1).PathName = "C:\config.sys"
'send message
iStatus = MAPISendMail(gMAPISession, 0&, tMessage, tRecip, tFiles(0),
MAPI_LOGON_UI, 0&)
If iStatus <> SUccESS_SUccESS Then
MsgBox MapiErr(iStatus)
Exit Sub
End If
'logoff of mail, release our session
iStatus = MAPILogoff(gMAPISession, 0, 0, 0)
MsgBox "Mail Successfully Sent"
End Sub
Can you help me please ?
Thanks
If I make tMessage.FileCount = 1 the message is sent OK with one attachment.
If I make tMessage.FileCount = 2 the message is not sent and I get error 11.
"MAPI Attachment not found".
Here is the code :-
Dim iStatus As Long
Dim gMAPISession As Long
Dim tMessage As MapiMessage
Dim tRecip As MapiRecip
Dim tFiles(2) As MapiFile
'first, logon to MAPI
iStatus = MAPILogon(0&, "", "", MAPI_LOGON_UI, 0&, gMAPISession)
If iStatus <> SUccESS_SUccESS Then
MsgBox MapiErr (iStatus)
Exit Sub
End If
'fill in the structures as needed
tRecip.RecipClass = MAPI_TO
tRecip.Name = "ovajay@usa.net"
tMessage.RecipCount = 1 'one receip
tMessage.FileCount = 2 '2 files
tMessage.Subject = "Test of MAPI"
tMessage.NoteText = Space(2) & vbNewLine & "Hello There"
'set up attachments
tFiles(0).Reserved = 0&
tFiles(0).Flags = 0
tFiles(0).Position = 1
tFiles(0).PathName = "C:\AUTOEXEC.BAT"
tFiles(1).Reserved = 0&
tFiles(1).Flags = 0
tFiles(1).Position = 2
tFiles(1).PathName = "C:\config.sys"
'send message
iStatus = MAPISendMail(gMAPISession, 0&, tMessage, tRecip, tFiles(0),
MAPI_LOGON_UI, 0&)
If iStatus <> SUccESS_SUccESS Then
MsgBox MapiErr(iStatus)
Exit Sub
End If
'logoff of mail, release our session
iStatus = MAPILogoff(gMAPISession, 0, 0, 0)
MsgBox "Mail Successfully Sent"
End Sub
Can you help me please ?
Thanks