AW: Leere Platzhalter-Zeilen entfernen
08.07.2021 13:38:01
Anita
Hallo, das ist mal der Code, den ich bisher habe... es funktioniert auch alles soweit, bis auf die leeren zeilen ^^
in den If-Funktionen habe ich versucht das Datum der Folgewoche mit einzubauen... das mit diesem Date+4 usw. is denk ich nicht so optimal... wenn es hier etwas besseres gibt könnt ihr mir gerne auch hier behilflich sein :)
@jochen: Danke für den Tipp - hat aber leider nicht geklappt. der hat mir gleich alles rot als Fehler markiert.
Option Explicit
Public Sub Email(Arg_Montag As Boolean, Arg_Dienstag As Boolean, Arg_Mittwoch As Boolean, Arg_Donnerstag As Boolean, Arg_Freitag As Boolean, Arg_Samstag As Boolean)
Dim V_WochentagMo As String
Dim V_WochentagDi As String
Dim V_WochentagMi As String
Dim V_WochentagDo As String
Dim V_WochentagFr As String
Dim V_WochentagSa As String
If Arg_Montag = True Then
V_WochentagMo = "Montag" & " " & "(" & CDate(Date + 4) & ")"
End If
If Arg_Dienstag = True Then
V_WochentagDi = "Dienstag" & " " & "(" & CDate(Date + 5) & ")"
End If
If Arg_Mittwoch = True Then
V_WochentagMi = "Mittwoch" & " " & "(" & CDate(Date + 6) & ")"
End If
If Arg_Donnerstag = True Then
V_WochentagDo = "Donnerstag" & " " & "(" & CDate(Date + 7) & ")"
End If
If Arg_Freitag = True Then
V_WochentagFr = "Freitag" & " " & "(" & CDate(Date + 8) & ")"
End If
If Arg_Samstag = True Then
V_WochentagSa = "Samstag" & " " & "(" & CDate(Date + 9) & ")"
End If
Dim V_OlApp As Object
Dim V_Adresse As String
Dim V_Kalenderwoche As Variant
V_Kalenderwoche = Format(Now, "ww")
Dim V_Mailnachricht As String
V_Mailnachricht = "" & _
"Hallo zusammen," & "
" & "ich bin in der KW " & V_Kalenderwoche & " an folgenden Tagen im Homeoffice:" & "
"
Dim V_Datum As Variant
Set V_OlApp = CreateObject("Outlook.Application")
V_Adresse = "(Empfänger-Adresse"
With V_OlApp.createitem(0)
.to = V_Adresse
.Subject = "[Homeoffice] Tage melden"
.htmlbody = V_Mailnachricht & "
" & _
V_WochentagMo & "
" & _
V_WochentagDi & "
" & _
V_WochentagMi & "
" & _
V_WochentagDo & "
" & _
V_WochentagFr & "
" & _
V_WochentagSa & "
" & _
.display
End With
End Sub