- Copy internal post link
- Copy external post link
- Report article
https://administrator.de/forum/makro-erstellen-fuers-outlook-ansichtseinstellungen-bedingte-formatierung-389609.html
[content:389609]
Makro erstellen fürs Outlook Ansichtseinstellungen Bedingte Formatierung
Ich bräuchte ein Makro zum Bedingte Formatierungen im Outlook zu erstellen.
Dies ist nur ein Beispiel Printscreen. Wäre super wenn man den Name im A1 - AEntlos hinschreiben könnte und im B1-BEntlos die Farbe. Der Suchname ist eigentlich immer im Betreff.
Ich bedanke mich schon im Voraus für Ere Hilfe
Content-Key: 389609
Url: https://administrator.de/contentid/389609
Printed on: May 14, 2024 at 22:05 o'clock
- Comment overview - Please log in
- Copy internal comment link
- Copy external comment link
- To the beginning of the comments
https://administrator.de/forum/makro-erstellen-fuers-outlook-ansichtseinstellungen-bedingte-formatierung-389609.html#comment-1317668
[content:389609#1317668]
- Copy internal comment link
- Copy external comment link
- To the beginning of the comments
https://administrator.de/forum/makro-erstellen-fuers-outlook-ansichtseinstellungen-bedingte-formatierung-389609.html#comment-1317778
[content:389609#1317778]
Option Explicit
# mögliche Farben
$colors = @{
olCategoryColorBlack = 15
olCategoryColorBlue = 8
olCategoryColorDarkBlue = 23
olCategoryColorDarkGray = 14
olCategoryColorDarkGreen = 20
olCategoryColorDarkMaroon = 25
olCategoryColorDarkOlive = 22
olCategoryColorDar###ge=17
olCategoryColorDarkPeach = 18
olCategoryColorDarkPurple = 24
olCategoryColorDarkRed = 16
olCategoryColorDarkSteel = 12
olCategoryColorDarkTeal = 21
olCategoryColorDarkYellow = 19
olCategoryColorGray = 13
olCategoryColorGreen = 5
olCategoryColorMaroon = 10
olCategoryColorNone = 0
olCategoryColorOlive = 7
olCategoryColorOrange = 2
olCategoryColorPeach = 3
olCategoryColorPurple = 9
olCategoryColorRed = 1
olCategoryColorSteel = 11
olCategoryColorTeal = 6
olCategoryColorYellow = 4
}
# Regeln die erstellt/modifiziert werden sollen
$settings = @{
"Testregel" = @{
Color=$colors.olCategoryColorBlack
Filter="`"http://schemas.microsoft.com/mapi/proptag/0x0037001f`" LIKE '%Testsubject%'"
}
"Testregel 2" = @{
Color=$colors.olCategoryColorRed
Filter="`"http://schemas.microsoft.com/mapi/proptag/0x0037001f`" LIKE '%Testsubject2%'"
}
}
# get outlook com-object
[void] [reflection.assembly]:: LoadWithPartialName ("microsoft.visualbasic")
$objOL = [microsoft.visualbasic.interaction]::GetObject($null,"Outlook.Application")
if (!$objOL){$objOL = New-Object -Com Outlook.Application}
$objOL.GetNamespace("MAPI").GetDefaultFolder(9).Views | ?{$_.Name -match '^(Kalender|Calendar)$'} | %{
$rules = $_.AutoFormatRules
$rulenames = $rules | ?{!$_.Standard} | select -Expand Name
$settings.GetEnumerator() | %{
if ($_.Name -in $rulenames){
write-host "Changing Rule '$($_.Name)'" -F Green
$key = $_.Name
$rule = $rules | ?{$_.Name -eq $key}
$rule.Filter = $_.Value.Filter
$rule.Font.ExtendedColor = $_.Value.Color
$rule.Enabled = $true
}else{
write-host "Adding Rule $($_.Name)" -F Green
$rule = $rules.Add($_.Name)
$rule.Filter = $_.Value.Filter
$rule.Font.ExtendedColor = $_.Value.Color
$rule.Enabled = $true
}
}
$_.AutoFormatRules.Save()
}
$objOL.Quit()
[void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($objOL)
- Copy internal comment link
- Copy external comment link
- To the beginning of the comments
https://administrator.de/forum/makro-erstellen-fuers-outlook-ansichtseinstellungen-bedingte-formatierung-389609.html#comment-1317899
[content:389609#1317899]
Und wenn man gar keinen Plan hat versucht man sich erst einmal die Grundlagen beizubringen.
- Copy internal comment link
- Copy external comment link
- To the beginning of the comments
https://administrator.de/forum/makro-erstellen-fuers-outlook-ansichtseinstellungen-bedingte-formatierung-389609.html#comment-1317920
[content:389609#1317920]
'Farben für Kategorie
Enum enuCatColor
Schwarz = 15
Blau = 8
Dunkelblau = 23
Dunkelgrau = 14
Dunkelgrün = 20
Dunkles_Kastanienbraun = 25
Dunkles_Olivgrün = 22
Dunkelorange = 17
Pfirsich_dunkel = 18
Dunkles_Lila = 24
Dunkelrot = 16
Dunkles_Stahlblau = 12
Dunkles_Blaugrün = 21
Dunkelgelb = 19
Grau = 13
Grün = 5
Braun = 10
Keine_Farbe = 0
Olivgrün = 7
Orange = 2
Pfirsichfarbe = 3
Violett = 9
Rot = 1
Stahlblau = 11
Blaugrün = 6
Gelb = 4
End Enum
Sub KategorieErstellen()
Dim oOutlookApp As Object
Dim oAufgabe As Object
Dim Mapi As Object, oCat As Object
Set oOutlookApp = CreateObject("Outlook.Application")
'Kategorie **********************************************************************
Set Mapi = oOutlookApp.GetNamespace("Mapi")
If Range("B2").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B2").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B2").Value, enuCatColor.Schwarz)
End If
End If
If Range("B3").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B3").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B3").Value, enuCatColor.Rot)
End If
End If
If Range("B4").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B4").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B4").Value, enuCatColor.Grün)
End If
End If
If Range("B5").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B5").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B5").Value, enuCatColor.Violett)
End If
End If
If Range("B6").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B6").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B6").Value, enuCatColor.Dunkelgelb)
End If
End If
If Range("B7").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B7").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B7").Value, enuCatColor.Braun)
End If
End If
If Range("B8").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B8").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B8").Value, enuCatColor.Dunkles_Kastanienbraun)
End If
End If
If Range("B9").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B9").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B9").Value, enuCatColor.Grau)
End If
End If
If Range("B10").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B10").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B10").Value, enuCatColor.Dunkelgrau)
End If
End If
If Range("B11").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B11").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B11").Value, enuCatColor.Pfirsichfarbe)
End If
If Range("B12").Value <> "" Then
For Each oCat In Mapi.Categories
If oCat.Name = Range("B12").Value Then
Exit For
End If
Next
If oCat Is Nothing Then
Set oCat = Mapi.Categories.Add(Range("B12").Value, enuCatColor.Gelb)
End If
End If
End If
End Sub
- Copy internal comment link
- Copy external comment link
- To the beginning of the comments
https://administrator.de/forum/makro-erstellen-fuers-outlook-ansichtseinstellungen-bedingte-formatierung-389609.html#comment-1317938
[content:389609#1317938]