I have a PS 5.1 script which still works very well to this day. But when I run it on PS 7.1, this portion of the script:
# # Warning: the first 3 lines of this 4-lint "Export-Excel" cmdlet # has the PowerShell back-tick" which may not be visible. # Export-Excel -path $Newfile -Title $CellA1 -Titlesize 13 ` -TitleFillPattern Solid -TitleBackgroundColor 10092543 ` -Autosize -FreezePane 3,2 -FreezeFirstColumn ` -Numberformat '##,###.00' -ExcludeProperty ID </pre></pre> fails with the following error message: <pre> Export-Excel: C:\Users\xxt35\Documents\PowerShell\V2P May-19 (0700)\PP13 - Yearly summary.ps1:293:64 Line | 293 | … -TitleFillPattern Solid -TitleBackgroundColor 10092543 ` | ~~~~~~~~ | Cannot process argument transformation on parameter 'TitleBackgroundColor'. Cannot convert the | "10092543" value of type "System.Int32" to type "System.Drawing.Color".
The integer 10092543 which follows ‘-TitleBackgroundColor’ is the value / setting for this parameter. It is supposed to set the color background for a specific cell to light blue (Aqua blue?).
Would be grateful if anyone knows if there’s a fix to this. Any advice, tips or workarounds will be highly appreciated. Many thanks.