To change the color of the font you are using in Word when executing a PowerShell script, you simply need to execute this commend:
$objSelection.Font.Color = "WDColorDarkBlue"
This command will turn the text Dark Blue. Here is the full script code:
$objWord = New-Object -comobject Word.Application
$objWord.Caption = "SvcHost Usage Report"
$objWord.Visible = $True
$objDoc = $objWord.Documents.Add()
$objSelection = $objWord.Selection
$objSelection.Font.Name = "Arial"
$objSelection.Font.Size = "18"
$objSelection.Font.Color = "WDColorDarkBlue"
$objSelection.TypeText("MCTExpert, Inc.")
Here is a list of possible color choices for your fonts when using a PowerShell script to write content to Microsoft Word.
· wdColorBlack,
· wdColorDarkRed
· wdColorRed
· wdColorDarkGreen
· wdColorOliveGreen
· wdColorBrown
· wdColorOrange
· wdColorGreen
· wdColorDarkYellow
· wdColorLightOrange
· wdColorLime
· wdColorGold
· wdColorBrightGreen
· wdColorYellow
· wdColorGray95
· wdColorGray90
· wdColorGray875
· wdColorGray85
· wdColorGray80
· wdColorGray75
· wdColorGray70
· wdColorGray65
· wdColorGray625
· wdColorDarkTeal
· wdColorPlum
· wdColorGray60
· wdColorSeaGreen
· wdColorGray55
· wdColorDarkBlue
· wdColorViolet
· wdColorTeal
· wdColorGray50
· wdColorGray45
· wdColorIndigo
· wdColorBlueGray
· wdColorGray40
· wdColorTan
· wdColorLightYellow
· wdColorGray375
· wdColorGray35
· wdColorGray30
· wdColorGray25
· wdColorRose
· wdColorAqua
· wdColorGray20
· wdColorLightGreen
· wdColorGray15
· wdColorGray125
· wdColorGray10
· wdColorGray05
· wdColorBlue
· wdColorPink
· wdColorLightBlue
· wdColorLavender
· wdColorSkyBlue
· wdColorPaleBlue
· wdColorTurquoise
· wdColorLightTurquoise
· wdColorWhite
· wdColorAutomatic
$objSelection.Font.Color = "WDColorDarkBlue"
This command will turn the text Dark Blue. Here is the full script code:
$objWord = New-Object -comobject Word.Application
$objWord.Caption = "SvcHost Usage Report"
$objWord.Visible = $True
$objDoc = $objWord.Documents.Add()
$objSelection = $objWord.Selection
$objSelection.Font.Name = "Arial"
$objSelection.Font.Size = "18"
$objSelection.Font.Color = "WDColorDarkBlue"
$objSelection.TypeText("MCTExpert, Inc.")
Here is a list of possible color choices for your fonts when using a PowerShell script to write content to Microsoft Word.
· wdColorBlack,
· wdColorDarkRed
· wdColorRed
· wdColorDarkGreen
· wdColorOliveGreen
· wdColorBrown
· wdColorOrange
· wdColorGreen
· wdColorDarkYellow
· wdColorLightOrange
· wdColorLime
· wdColorGold
· wdColorBrightGreen
· wdColorYellow
· wdColorGray95
· wdColorGray90
· wdColorGray875
· wdColorGray85
· wdColorGray80
· wdColorGray75
· wdColorGray70
· wdColorGray65
· wdColorGray625
· wdColorDarkTeal
· wdColorPlum
· wdColorGray60
· wdColorSeaGreen
· wdColorGray55
· wdColorDarkBlue
· wdColorViolet
· wdColorTeal
· wdColorGray50
· wdColorGray45
· wdColorIndigo
· wdColorBlueGray
· wdColorGray40
· wdColorTan
· wdColorLightYellow
· wdColorGray375
· wdColorGray35
· wdColorGray30
· wdColorGray25
· wdColorRose
· wdColorAqua
· wdColorGray20
· wdColorLightGreen
· wdColorGray15
· wdColorGray125
· wdColorGray10
· wdColorGray05
· wdColorBlue
· wdColorPink
· wdColorLightBlue
· wdColorLavender
· wdColorSkyBlue
· wdColorPaleBlue
· wdColorTurquoise
· wdColorLightTurquoise
· wdColorWhite
· wdColorAutomatic
Comments