Erwartet Anweisungsende
20.09.2022 15:30:36
Georg
Ich bin jetzt nicht so versiert, was meine Kenntnisse angeht, den Code habe ich gefunden, und wollte ihn auf meine Anforderungen anpassen. Ein Tipp wäre wie immer prima! Vielen Dank und Gruß Georg
Private Sub CommandButton1_Click()
Dim xOutApp As Object
Dim xOutMail As Object
' Dim xMailbody As String
Dim xMailbody As Object
On Error Resume Next
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
Dim lastWsh As Worksheet
Set lastWsh = ThisWorkbook.Worksheets(Sheets.Count)
Dim Ticketinhalt As Range
Set Ticketinhalt = lastWsh.UsedRange.Copy
xMailBody = ticketinhalt.PasteSpecial paste:=xlvalues
' xMailBody = "Body content" & vbNewLine & vbNewLine & _
' "This is line 1" & vbNewLine & _
' "This is line 2"
On Error Resume Next
With xOutMail
.to = "Email Address"
.CC = ""
.BCC = ""
.Subject = "Test email send by button clicking"
.Body = xMailbody
.Display 'or use .Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub