Color Property, PivotSelect in Excel
i trying set color of pivottables subtotals. can accomplish pretty easy in vba this
activesheet.pivottables(1).pivotselect("description[all;total]",0) selection.interior.color = 13434879 but in powershell code below returns error below
$selection = $pivot.pivotselect("description[all;total]",0) $selection.interior.color = 13434879 property 'color' cannot found on object; make sure exists , settable. @ k:\exp.ps1:248 char:21 + $selection.interior. <<<< color = 13434879 + categoryinfo : invalidoperation: (color:string) [], runtimeexception + fullyqualifiederrorid : propertynotfound
the pivotselect method not return object, therefore $selection null. you can retrieve selection application object — code below assumes in $xl — , set new background color there:
$pivot.pivotselect("description[all;total]",0)
$xl.selection.interior.color = 13434879
Windows Server > Windows PowerShell
Comments
Post a Comment