Compartilhar via


Propriedade Category.Color (Outlook)

Retorna ou define uma constante OlCategoryColor que indica a cor utilizada pelo objeto Category. Leitura/gravação.

Sintaxe

expressão. Cor

Expressão Uma variável que representa um objeto Category .

Comentários

Você pode compartilhar a mesma cor para várias categorias, especificando a constante mesma que representa a cor de categoria na enumeração OlCategoryColor para esses objetos Category.

Exemplo

O seguinte exemplo Visual Basic for Applications (VBA) exibe uma caixa de diálogo contendo as atribuições de cores para cada objeto Category contido no conjunto Categories associado ao objeto NameSpace padrão.

Private Sub ListCategoryColors() 
 Dim objNameSpace As NameSpace 
 Dim objCategory As Category 
 Dim strOutput As String 
 
 ' Obtain a NameSpace object reference. 
 Set objNameSpace = Application.GetNamespace("MAPI") 
 
 ' Check if the Categories collection for the Namespace 
 ' contains one or more Category objects. 
 If objNameSpace.Categories.Count > 0 Then 
 
 ' Enumerate the Categories collection, checking 
 ' the value of the Color property for 
 ' each Category object. 
 For Each objCategory In objNameSpace.Categories 
 
 ' Add the name of the Category object to 
 ' the output string. 
 strOutput = strOutput & objCategory.Name 
 
 ' Add information about the assigned color 
 ' to the output string. 
 Select Case objCategory.Color 
 Case OlCategoryColor.olCategoryColorNone 
 strOutput = strOutput & ": No color" & vbCrLf 
 Case OlCategoryColor.olCategoryColorBlack 
 strOutput = strOutput & ": Black " & vbCrLf 
 Case OlCategoryColor.olCategoryColorBlue 
 strOutput = strOutput & ": Blue" & vbCrLf 
 Case OlCategoryColor.olCategoryColorGray 
 strOutput = strOutput & ": Gray" & vbCrLf 
 Case OlCategoryColor.olCategoryColorGreen 
 strOutput = strOutput & ": Green" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightBlue 
 strOutput = strOutput & ": Light blue" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightGray 
 strOutput = strOutput & ": Light gray" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightGreen 
 strOutput = strOutput & ": Light green" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightMaroon 
 strOutput = strOutput & ": Light maroon" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightOlive 
 strOutput = strOutput & ": Light olive" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightOrange 
 strOutput = strOutput & ": Light orange" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightPeach 
 strOutput = strOutput & ": Light peach" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightPurple 
 strOutput = strOutput & ": Light purple" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightRed 
 strOutput = strOutput & ": Light red" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightSteel 
 strOutput = strOutput & ": Light steel" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightTeal 
 strOutput = strOutput & ": Light teal" & vbCrLf 
 Case OlCategoryColor.olCategoryColorLightYellow 
 strOutput = strOutput & ": Light yellow" & vbCrLf 
 Case OlCategoryColor.olCategoryColorMaroon 
 strOutput = strOutput & ": Maroon" & vbCrLf 
 Case OlCategoryColor.olCategoryColorOlive 
 strOutput = strOutput & ": Olive" & vbCrLf 
 Case OlCategoryColor.olCategoryColorOrange 
 strOutput = strOutput & ": Orange" & vbCrLf 
 Case OlCategoryColor.olCategoryColorPeach 
 strOutput = strOutput & ": Peach" & vbCrLf 
 Case OlCategoryColor.olCategoryColorPurple 
 strOutput = strOutput & ": Purple" & vbCrLf 
 Case OlCategoryColor.olCategoryColorRed 
 strOutput = strOutput & ": Red" & vbCrLf 
 Case OlCategoryColor.olCategoryColorSteel 
 strOutput = strOutput & ": Steel" & vbCrLf 
 Case OlCategoryColor.olCategoryColorTeal 
 strOutput = strOutput & ": Teal" & vbCrLf 
 Case OlCategoryColor.olCategoryColorYellow 
 strOutput = strOutput & ": Yellow" & vbCrLf 
 Case Else 
 strOutput = strOutput & ": Unknown" & vbCrLf 
 End Select 
 Next 
 End If 
 
 ' Display the output string. 
 MsgBox strOutput 
 
 ' Clean up. 
 Set objCategory = Nothing 
 Set objNameSpace = Nothing 
 
End Sub

Confira também

Objeto Category

Suporte e comentários

Tem dúvidas ou quer enviar comentários sobre o VBA para Office ou sobre esta documentação? Confira Suporte e comentários sobre o VBA para Office a fim de obter orientação sobre as maneiras pelas quais você pode receber suporte e fornecer comentários.