Zum Inhalt springen
Frage 16. Januar 2009, 09:17 Uhr · 5 Antworten

Outlook Automatische Mail an 2 Empfänger

Hallo Leute,

durch tatkräftige Unterstützung von euch habe ich als Laie mit euch zusammen folgendes für eine wöchentliche automatische mail erstellt:

Option Explicit
’
Sub Senden()
Dim oTask As Outlook.TaskItem
Dim oMail As Outlook.MailItem
Dim oFld As Outlook.MAPIFolder
Const TEMPLATE_SUBJECT As String = „Abholung Leergut“
Const TEMPLATE_ADR As String = „[email protected]“
Dim Txt As String
Txt = „Hallo Herr XXX,“ + vbCrLf + vbCrLf
Txt = Txt + „bitte teilen Sie uns die Anzahl der Leergut-Paletten die am Montag zu holen sind mit.“ + vbCrLf + vbCrLf
Txt = Txt & „Vielen Dank“ + vbCrLf + vbCrLf + vbCrLf
Txt = Txt & „Mit freundlichen Grüßen“ + vbCrLf + vbCrLf
Txt = Txt & „Patrick XXX“ + vbCrLf
Txt = Txt & „__________________________________________“ + vbCrLf + vbCrLf
Txt = Txt & „C & L Service GmbH“ + vbCrLf
Txt = Txt & „Salvatorstr. 15a“ + vbCrLf
Txt = Txt & „85290 Geisenfeld-Nötting“ + vbCrLf
Txt = Txt & „Telefon: +49 8456 - 91 54 39“ + vbCrLf
Txt = Txt & „Telefax: +49 8456 - 91 60 65“ + vbCrLf
Txt = Txt & „E -Mail: [email protected]“ + vbCrLf
Txt = Txt & „Internet: http://www.c-l-service.de“ + vbCrLf
Txt = Txt & „__________________________________________“ + vbCrLf + vbCrLf
Txt = Txt & „Geschäftsführer Heiko Eschner“ + vbCrLf
Txt = Txt & „Amtsgericht Pfaffenhofen a.d.Ilm“ + vbCrLf
Txt = Txt & „Handelsregisterbuch 4592“ + vbCrLf
Txt = Txt & „Ust-Id-Nr. DE 247486292“ + vbCrLf
Txt = Txt & „Steuer-Nr. 124/123/50489“
Set oMail = Application.CreateItem(olMailItem)
oMail.Subject = TEMPLATE_SUBJECT
oMail.Body = Txt
oMail.Recipients.Add TEMPLATE_ADR
oMail.Send
End Sub
’
Function SchonGesendet() As Boolean
Dim FF As Long, Satz As String
If Weekday(Date, vbMonday) 5 Then
SchonGesendet = True
Exit Function
End If
If Dir(„C:\OLTest/nul“) = „“ Then
MkDir „C:\OLTest“
FF = FreeFile
Open „C:\OLTest\Gesendet.txt“ For Output As #FF
Close #FF
End If
FF = FreeFile
Open „C:\OLTest\Gesendet.txt“ For Input As #FF
While Not EOF(FF)
Line Input #FF, Satz
Wend
Close #FF
If Satz = Format(Date, „yyyymmdd“) Then SchonGesendet = True
End Function

Wie kann ich jetzt aus einem Empfänger zwei machen? mit ; dazwischen gehts nicht, dahinter die neue Adresse auch in „“ geht nicht und in „“ und zwischen den beiden Mail Adressen ; geht auch nicht. Wie ist denn das Trennzeichen im VB?

Danke
Patrick

Diese Frage stammt aus dem Jahr 2009. Weißt du es heute besser?

Aktuelle Antwort ergänzen

5 Antworten

Hallo Patrick,
so wies aussieht,
musst Du nur
oMail.Recipients.Add MailAdresse1
oMail.Recipients.Add MailAdresse2
aus Deinem
oMail.Recipients.Add TEMPLATE_ADR
machen …

Gruß
Klaus

0 Hilfreich
Antwort auf Klaus_58a5cezum Beitrag ↑

Hallo Patrick, so wies aussieht, musst Du nur oMail.Recipients.Add MailAdresse1 oMail.Recipients.Add MailAdresse2 aus Deinem oMail.Recipients.Add TEMPLATE_ADR machen … Gruß Klaus

Hallo Klaus,

dann muss ich doch auch in der Mailadressen Zeile

Const MailAdresse1 As String = „[email protected]“
Const MailAdresse1 As String = „[email protected]“

einsetzen oder? Nur da sagt er mir dann Mehrfachdeklaration im aktuellen Gültungsbereich.

Was ist da falsch?

Gruß
Patrick

0 Hilfreich
Antwort auf Patrick_0bac93zum Beitrag ↑

Hallo Klaus, dann muss ich doch auch in der Mailadressen Zeile Const MailAdresse1 As String = „ [email protected] “ Const MailAdresse1 As String = „ [email protected] “ einsetzen oder? Nur da sagt …

Bitte um ANtwort da es noch nicht abgeschlosswen ist. So sieht es jetzt aus (vorher siehe erster Artikel).

Option Explicit
’
Sub Senden()
Dim oTask As Outlook.TaskItem
Dim oMail As Outlook.MailItem
Dim oFld As Outlook.MAPIFolder
Const TEMPLATE_SUBJECT As String = „Abholung Leergut“
Const MailAdresse1 As String = „[email protected]“
Const MailAdresse1 As String = „[email protected]“
Dim Txt As String
Txt = „Hallo Herr XXX,“ + vbCrLf + vbCrLf
Txt = Txt + „bitte teilen Sie uns die Anzahl der Leergut-Paletten die am Montag zu holen sind mit.“ + vbCrLf + vbCrLf
Txt = Txt & „Vielen Dank“ + vbCrLf + vbCrLf + vbCrLf
Txt = Txt & „Mit freundlichen Grüßen“ + vbCrLf + vbCrLf
Txt = Txt & „Patrick Eschner“ + vbCrLf
Txt = Txt & „__________________________________________“ + vbCrLf + vbCrLf
Txt = Txt & „C & L Service GmbH“ + vbCrLf
Txt = Txt & „Salvatorstr. 15a“ + vbCrLf
Txt = Txt & „85290 Geisenfeld-Nötting“ + vbCrLf
Txt = Txt & „Telefon: +49 8456 - 91 54 39“ + vbCrLf
Txt = Txt & „Telefax: +49 8456 - 91 60 65“ + vbCrLf
Txt = Txt & „E -Mail: [email protected]“ + vbCrLf
Txt = Txt & „Internet: http://www.c-l-service.de“ + vbCrLf
Txt = Txt & „__________________________________________“ + vbCrLf + vbCrLf
Txt = Txt & „Geschäftsführer Heiko Eschner“ + vbCrLf
Txt = Txt & „Amtsgericht Pfaffenhofen a.d.Ilm“ + vbCrLf
Txt = Txt & „Handelsregisterbuch 4592“ + vbCrLf
Txt = Txt & „Ust-Id-Nr. DE 247486292“ + vbCrLf
Txt = Txt & „Steuer-Nr. 124/123/50489“
Set oMail = Application.CreateItem(olMailItem)
oMail.Subject = TEMPLATE_SUBJECT
oMail.Body = Txt
oMail.Recipients.Add MailAdresse1
oMail.Recipients.Add MailAdresse2
oMail.Send
End Sub
’
Function SchonGesendet() As Boolean
Dim FF As Long, Satz As String
If Weekday(Date, vbMonday) 5 Then
SchonGesendet = True
Exit Function
End If
If Dir(„C:\OLTest/nul“) = „“ Then
MkDir „C:\OLTest“
FF = FreeFile
Open „C:\OLTest\Gesendet.txt“ For Output As #FF
Close #FF
End If
FF = FreeFile
Open „C:\OLTest\Gesendet.txt“ For Input As #FF
While Not EOF(FF)
Line Input #FF, Satz
Wend
Close #FF
If Satz = Format(Date, „yyyymmdd“) Then SchonGesendet = True
End Function

Wo ist der Fehler?

0 Hilfreich
Antwort auf Patrick_0bac93zum Beitrag ↑

Bitte um ANtwort da es noch nicht abgeschlosswen ist. So sieht es jetzt aus (vorher siehe erster Artikel). Option Explicit ’ Sub Senden() Dim oTask As Outlook.TaskItem Dim oMail As Outlook.MailItem Dim oFld As Outlook.MA …

Hi Patrick,
Du hast auch eine Doppelte Deklaration:
Ich werde mal die Fehler die ich finde markieren:

Option Explicit
'
Sub Senden()
Dim oTask As Outlook.TaskItem
Dim oMail As Outlook.MailItem
Dim oFld As Outlook.MAPIFolder
Const TEMPLATE\_SUBJECT As String = "Abholung Leergut"
Const MailAdresse1 As String = "[email protected]"
Const MailAdresse1 As String = "[email protected]" '

War nur einer.
Versuchs jetzt mal ...
0 Hilfreich
Antwort auf Klaus_58a5cezum Beitrag ↑

Hi Patrick, Du hast auch eine Doppelte Deklaration: Ich werde mal die Fehler die ich finde markieren: Option Explicit ' Sub Senden() Dim oTask As Outlook.TaskItem Dim oMail As Outlook.MailItem Dim oFld As Outlook.MAPIFol …

Oh man, so einfach kanns gehen…
DANKE

0 Hilfreich

Deine Antwort

Zum Antworten bitte anmelden oder kostenlos registrieren.