Ich spendier dir eine Procedure, die ich seinerzeit für Access97 geschrieben (abgeschrieben/umgeschrieben) habe. Vielleicht gibt es jetzt schon elegantere Lösungen, habe mich aber damit nicht mehr beschäftigt.
-------------------------------
Function SendMess(Typ, SendNam)
'Typ=TO oder CC
'Sendnam=Emailadresse
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
'Dim objOutlookSubject As Outlook.Subject
'existierendes oder neues Outlook starten
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
If Err.Number <> 0 Then
Err.Clear
Set objOutlook = CreateObject("Outlook.Application")
End If
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add(SendNam)
If Typ = "TO" Then
' Add the To recipient(s) to the message.
objOutlookRecip.Type = olTo
Else
' Add the CC recipient(s) to the message.
objOutlookRecip.Type = olCC
End If
.Display
End With
Set objOutlook = Nothing
End Function
-----------------------------------
Zugriff über zwei Buttons (TO, CC):
"EMAIL" ist der von mir vergebene Steuerelementname (und auch der Feldname):
Private Sub Befehl116_Click()
a = SendMess("TO", Me!EMAIL)
End Sub
Private Sub Befehl117_Click()
a = SendMess("CC", Me!EMAIL)
End Sub
|