Hallo zusammen,
ich habe folgendes Problem..
Ich habe ein Makro, welches mir einen Screenshot von einem bestimmten Bereich macht, anschließen eine neue Mail erstellt und diesen einfügt.
Mein Problem dabei ist, dass in dem Screenshot auch 2 Bilder drinnen sein sollten und diese nicht angezeigt werden können. Habt ihr hier eine Idee? :-/
Danke im Voraus und LG
Benny
ich habe folgendes Problem..
Ich habe ein Makro, welches mir einen Screenshot von einem bestimmten Bereich macht, anschließen eine neue Mail erstellt und diesen einfügt.
Mein Problem dabei ist, dass in dem Screenshot auch 2 Bilder drinnen sein sollten und diese nicht angezeigt werden können. Habt ihr hier eine Idee? :-/
Visual Basic-Quellcode
- Sub Versand()
- 'Versand Makro
- 'Dimensionen
- Dim oOutlookApp As Object, oOutlookMessage As Object
- Dim oFSObj As Object, oFSTextStream As Object
- Dim rngeSend As Range, strHTMLBody As String, strTempFilePath As String
- Dim ColIndex, RowIndex, Var1, Var2 As Integer
- Dim DatumSheet
- Sheets("Protokoll").Select
- 'Zählt wie viele Zellen kopiert werden sollen
- On Error Resume Next
- Range("B1:J41").Select
- Set rngeSend = Selection
- If rngeSend Is Nothing Then Exit Sub 'User pressed Cancel
- On Error GoTo 0
- 'Pfad für temporäre Datei
- Set oFSObj = CreateObject("Scripting.FilesystemObject")
- strTempFilePath = oFSObj.GetSpecialFolder(2)
- strTempFilePath = strTempFilePath & "\XLRange.htm"
- 'Hier wird die HTML-Datei erstellt
- ActiveWorkbook.PublishObjects.Add(4, strTempFilePath, _
- rngeSend.Parent.Name, rngeSend.Address, 0, "", "").Publish True
- 'Outlook session öffnen
- Set oOutlookApp = CreateObject("Outlook.Application")
- 'Neue email
- Set oOutlookMessage = oOutlookApp.CreateItem(0)
- For i = 1 To 1 'Für einen Serienbrief muss hier der zweite um die jeweilige Briefanzahl erhöht werden.
- 'oOutlookMessage.To = Range("Formeln!A1").Value
- oOutlookMessage.To = "EMPFÄNGER DER MAIL"
- 'oOutlookMessage.Subject = Range("Formeln!A2").Value & " " & Mid(Time, 1, 2) & ":00 Uhr am " & Date
- oOutlookMessage.Subject = "Protokoll vom " & Range("H8")
- 'Die HTML-Datei wird geöffnet mit FilesystemObject
- Set oFSTextStream = oFSObj.OpenTextFile(strTempFilePath, 1)
- 'HTMLBody
- strHTMLBody = oFSTextStream.ReadAll
- oOutlookMessage.Htmlbody = strHTMLBody
- oOutlookMessage.Display
- 'oOutlookMessage.send
- Cells(1, 1).Select
- Next i
- ActiveWorkbook.Save
- End Sub
Danke im Voraus und LG
Benny