Thema Datum  Von Nutzer Rating
Antwort
26.09.2017 10:29:06 Alex
NotSolved
01.10.2017 21:41:25 Ben
NotSolved
02.10.2017 09:23:30 Alex
NotSolved
Blau Excel VBA mehrere Screenshots per Mail direkt im Body
02.10.2017 09:37:10 SJ
NotSolved

Ansicht des Beitrags:
Von:
SJ
Datum:
02.10.2017 09:37:10
Views:
675
Rating: Antwort:
  Ja
Thema:
Excel VBA mehrere Screenshots per Mail direkt im Body

Hallo,

eine Möglichkeit:

Option Explicit

'<--Verweise-->
'Microsoft Outlook xx.x Object Library

Public Sub createMail()
    Dim appOut As Outlook.Application
    Dim outMail As Outlook.MailItem
    
    On Error Resume Next
    Set appOut = GetObject("Outlook.Application")
    If appOut Is Nothing Then
        Set appOut = CreateObject("Outlook.Application")
    End If
    On Error GoTo 0
    
    On Error GoTo errorhandler
    If appOut Is Nothing Then
        MsgBox "Kein Outlook installiert?!", vbInformation
        GoTo cleanUp
    End If
    
    Set outMail = appOut.CreateItem(olMailItem)
    
    With outMail
        .Subject = "Testmail"
        .Recipients.Add "someone@somedomain.com"
        .Attachments.Add "C:\Users\Public\Pictures\Sample Pictures\Desert.jpg"
        .HTMLBody = "<p>Mailbody mit Bild</p>" & vbCrLf & _
            "<img src='cid:Desert.jpg'" & "width='500' height='200'>"
        .Display
    End With
    On Error GoTo 0
    
cleanUp:
    If Not appOut Is Nothing Then Set appOut = Nothing
    If Not outMail Is Nothing Then Set outMail = Nothing
    Exit Sub
    
errorhandler:
    MsgBox "Es ist leider ein Fehler aufgetreten:" & vbCrLf & _
        "Fehlernummer: " & Err.Number & vbCrLf & _
        "Fehlerbeschreibung: " & Err.Description, vbExclamation
    GoTo cleanUp
End Sub

Viele Grüße


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
26.09.2017 10:29:06 Alex
NotSolved
01.10.2017 21:41:25 Ben
NotSolved
02.10.2017 09:23:30 Alex
NotSolved
Blau Excel VBA mehrere Screenshots per Mail direkt im Body
02.10.2017 09:37:10 SJ
NotSolved