HINWEIS
Kapitel 14: Access im Internet/Intranet
Für eine ordnungsgemäße Ausführung des Beispiels wird die Installation von Microsoft Outlook vorausgesetzt.
Mailversand über die MAPI
Ein dritte Möglichkeit bietet sich mit Hilfe der Message-API-Schnittstelle. Wir verwenden die Funktion
MapiSendMail, die von der Mapi32.dll exportiert wird. Doch Vorsicht, VBA »brät mal wieder eine Extra-
wurst«: Beim Importieren der benötigten API-Funktionen sollten Sie Vorsicht walten lassen. Was uns da
mit dem Namen MapiSendMail »untergeschoben« wird, ist eine ganz andere Funktion mit anderen Para-
metern:
Private Type MapiRecip
Reserved As Long
RecipClass As Long
Name As String
Address As String
EIDSize As Long
EntryID As String
End Type
Private Type MapiFile
Reserved As Long
Flags As Long
Position As Long
PathName As String
FileName As String
FileType As String
End Type
Private Type MAPIMessage
Reserved As Long
Subject As String
NoteText As String
MessageType As String
DateReceived As String
ConversationID As String
Flags As Long
RecipCount As Long
FileCount As Long
End Type
Private Declare Function MapiSendMail Lib "MAPI32.DLL" Alias "BMAPISendMail" _
(ByVal Session&, ByVal UIParam&, Message As MAPIMessage, Recipient() As MapiRecip, _
File() As MapiFile, ByVal Flags&, ByVal Reserved&) As Long
Private Const MAPI_DIALOG = &H8
Private Const MAPI_LOGON_UI = &H1
Private Const MAPI_NEW_SESSION = &H2
Private Sub Command1_Click()
Dim mmessage As MAPIMessage
Dim Recipient(1) As MapiRecip, File() As MapiFile
918

Get Microsoft Office Access 2007-Programmierung - Das Handbuch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.