ich habe folgenden Code :
(das Makro laeuft)
Private Sub CommandButton9_Click()
Dim oOL As Object, oMail As Object
' oInspector, myattachments brauchts nicht, MyAnsw wird zumindest nicht verwendet
' Dim MyAnsw As String
Dim sFile As String
Dim oWb As Workbook
On Error Resume Next
Set oWb = ActiveWorkbook
' Pfad- und Namensvergabe - kann auch hardcoded erfolgen, sollte nicht dem der aktuellen entsprechen!
sFile = "C:\" & oWb.Name
' Ist die akt. Mappe schon gespeichert? (andernfalls .xls anhängen)
If oWb.Path = "" Then sFile = sFile & ".xls"
' eine Kopie speichern
oWb.SaveCopyAs sFile
' unnötig, hingegen s. Ende
' Set oOL = Nothing
' Set oInspector = Nothing
' Set oMail = Nothing
Set oOL = CreateObject("Outlook.Application")
Set oMail = oOL.CreateItem(0)
With oMail
.To = ""
.Subject = ""
.htmlbody = ""
.Attachments.Add sFile ' hier ggf. weitere optionale Parameter
.Display
End With
DoEvents
' Temp. Kopie wieder löschen
Kill sFile
Set oOL = Nothing
End Sub
In den Htmlbody: hier soll immer der gleiche Text stehen:
Kind regards/MFG
Klaus Mustermann
Financial Controller
Mustermann AG
Telefon usw.
Der Name soll in Gruener Schrift und die Firmenbezeichnung auch
Kann das einer?
Gruss
Matthias