hallo,
kann mir jemand helfen, es funktioniert irgendwie nicht ein email via outlook zu senden.
Ab Set olOutlookApp = CreateObject("Outlook.Application") springt das prog. in die fehlerausgabe.
thx
gude
mk
kann mir jemand helfen, es funktioniert irgendwie nicht ein email via outlook zu senden.
Ab Set olOutlookApp = CreateObject("Outlook.Application") springt das prog. in die fehlerausgabe.
Code:
Public Sub SendeeMail(eMail As String, Optional Subject As String, Optional Body As String, Optional Attachment As String)
On Error GoTo withoutlook
' Generate and send E-mail
Set olOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
' Outlook not running - start it
Set olOutlookApp = CreateObject("Outlook.Application")
blnNewOutlookApp = True
End If
' Create E-mail
Set olEMail = olOutlookApp.CreateItem(olMailItem)
With olEMail
.To = "bla@bla.de"
.Subject = "TESTMAIL"
.Body = "Hier is de Body"
'.Attachments.Add ActiveDocument.FullName, olByValue, , "Inspection Request"
'.Attachments.Add ("c:\test.doc")
.Send
End With
withoutlook:
MsgBox "Mails können nur verschickt werden, nachdem Outlook gestartet wurde", vbCritical, "Outlook Fehler"
thx
gude
mk