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

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file