eMail aus Excel heraus
23.07.2013 17:31:48
Rebecca
nachdem ich gestern so tolle Hilfe erhalten habe, hätte ich noch ein Anliegen.
Ich möchte, wenn die Exceldatei beendet wird, das sich ein e-Mail Fenster öffnet. Das funktioniert mit untenstehenden Code auch prima. Nun hätte ich jedoch gern, dass wenn in Zelle A "xxx" steht die eMail an user1 geht und wenn in Zelle A "bbb" steht, die an user2 adressiert wird.
Geht das irgendwie?
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim APP_OUTLOOK As Object
Dim MESSAGE As Object
Dim STR_WKB_PATH As String
Set APP_OUTLOOK = CreateObject("Outlook.Application")
Set MESSAGE = APP_OUTLOOK.CreateItem(0)
STR_WKB_PATH = ActiveWorkbook.Path
Application.Quit
With MESSAGE
.to = "user1@test.de""
.Subject = "Reservierung" & " - " & Format(Now, "DD.MM.YY HH:MM")
.HTMLBody = "bla..bla..bla"
.Display
End With
Set APP_OUTLOOK = Nothing
Set MESSAGE = Nothing
End Sub
Danke Euch schon mal. :-)
Rebecca