Hallo,
Ich habe schon viel ausprobiert, aber ich bekomme immer die selbe Fehlermeldung
Objektvariable oder With-Blockvariable nicht festgelegt.
Ich möchte bei einer Outlook-Besprechung die Schriftfarbe ändern.
Das Problem tritt bei "objSel.Font.ColorIndex = 2" auf.
Hier der Code
Sub terminErstellen(ByRef art, ByRef termin, ByRef rs)
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objSel As Word.Selection
With termin
.MeetingStatus = 1
.RequiredAttendees = getAttendees(rs)
Debug.Print getAttendees(rs)
.subject = rs!t_nr & " POS (" & Format(rs!t_datum, "dd.mm.yyyy") & ")"
If art = "POS" Then
.subject = .subject & " Ausstrahlung/Aussendung"
.start = Format(rs!t_datum, "dd.mm.yyyy") & " 09:00"
.ReminderMinutesBeforeStart = 0
ElseIf art = "Dreh" Then
.start = Format(rs!t_aufnahme_am, "dd.mm.yyyy") & " " & Format(rs!t_aufnahme_am_uhrzeit, "hh:mm")
.ReminderMinutesBeforeStart = 15
.subject = .subject & " Videodreh"
ElseIf art = "Informationen" Then
.subject = .subject & " Info finalisieren"
.start = Format(rs!t_informationen_bis, "dd.mm.yyyy") & " " & Format(rs!t_informationen_bis_uhrzeit, "hh:mm")
.ReminderMinutesBeforeStart = 1440
End If
.Duration = 60
.AllDayEvent = False
.Location = "POS"
.Categories = art
.body = kalenderTextErstellen(rs) ' .body = (rs) & getAttendees(rs)
Set objDoc = .GetInspector.WordEditor
Set objWord = objDoc.Application
Set objSel = objWord.Selection
objSel.Font.ColorIndex = 2
.ReminderSet = True
If IsEmpty(rs!t_anhang) = True Or IsNull(rs!t_anhang) Or rs!t_anhang = "" Then
Else
Debug.Print rs!t_anhang
.Attachments.Add Replace(rs!t_anhang, "#", "")
End If
If IsEmpty(rs!t_anhang2) = True Or IsNull(rs!t_anhang2) Or rs!t_anhang2 = "" Then
Else
.Attachments.Add Replace(rs!t_anhang2, "#", "")
End If
.Save
.Send
End With
Set objItem = Nothing
Set olInsp = Nothing
Set wdDoc = Nothing
Set oRng = Nothing
End Sub
Danke schonmal für die Hilfe
|