ich habe folgenden Code um E-Mails zu versenden:
Sub SendXLS()
Dim newWB As Workbook, wbThis As Workbook
Application.DisplayAlerts = False
Set wbThis = ActiveWorkbook
wbThis.Worksheets(2).Copy
Set newWB = ActiveWorkbook
newWB.SaveAs wbThis.Path & "\" & wbThis.Worksheets(2).Name & ".xlsx", XlFileFormat. _
xlOpenXMLWorkbook
email "max@muster.de", "Testsubject", "Testbody", Array(newWB.FullName)
newWB.Close
Application.DisplayAlerts = True
End Sub
Function email(sMailto, sSubject, sBodyText, arrAttachments As Variant)
On Error Resume Next
Set objOutlook = GetObject("", "Outlook.Application")
If objOutlook Is Nothing Then
Set objOutlook = CreateObject("Outlook.Application")
End If
' Set objMail = objOutlook.CreateItem(0)
' Mail anhand eines *.oft Templates erstellen
Set objMail = objOutlook.CreateItemFromTemplate("C:\temp\excel2mail\Paletten_bestellen.oft") _
_
If Not objMail Is Nothing Then
With objMail
.To = sMailto
.Subject = sSubject
.Body = sBodyText
If UBound(arrAttachments) -1 Then
For i = 0 To UBound(arrAttachments)
.Attachments.Add arrAttachments(i)
Next
End If
.Display
.Send
End With
End If
Set objOutlook = Nothing
End Function
Den Code habe ich aber nicht selber geschrieben, und tue mich echt schwer damit ihn zu verstehen..Zur Zeit ist es so, dass der Code mit dem drücken eines CommandButton aktiviert wird (selbst die Stelle wo ich das raus lesen kann finde ich nicht :/)
Ich möchte folgendes:
Eine Liste in Excel mit Namen und E-Mail Adressen die ich mit CheckBoxen markieren kann um so zu bestimmen an wen die die Tabelle per E-Mail geschickt werden soll.
Kann mir da jemand helfen?
Und hat jemand eine Idee, wie ich am besten daran gehe um den Code zu verstehen..
Liebe Grüße,
Jessi