Hallo an alle
Ich möchte eine Arbeitsmappe schließen, nachdem ich die Änderungen darin gespeichert habe und dann automatisch eine Mail erzeugt wird.
Speichern und mailen funktioniert bereits, nur hatte ich es bisher so, das dann immer Excel mit geschlossen wurde.
Leider wurden dann auch andere Dokumente ohne zu speichern mit geschlossen.
Vielleicht kann mir jemand von euch weiterhelfen.
Hier mal mein Text im VBA
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim APP_OUTLOOK As Object
Dim MESSAGE As Object
Set APP_OUTLOOK = CreateObject("Outlook.Application")
Set MESSAGE = APP_OUTLOOK.CreateItem(0)
With MESSAGE
.to = "xxxxx"
.Subject = "xxxx"
.HTMLbody = "xxxx-" & _
" <a href=""xxxx> "
.Display
End With
Set APP_OUTLOOK = Nothing
Set MESSAGE = Nothing
ThisWorkbook.Saved = True
Application.Quit
End Sub