I have error Exception calling Workbooks.Open():
"Open" with "1" argument(s): "Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))"
$Files = Get-ChildItem -Path "C:\daily reports" "*.xlsx" -Recurse |
         Select -Expand FullName
$excl = New-Object -ComObject "Excel.Application"
foreach ($file in $Files) {
    $wrkb = $excl.Workbooks.Open($file)
    $excl.DisplayAlerts = $false
    $wrkb.Save()
    $wrkb.Close()
}
$excl.Quit()
kill -processname excel
User contributions licensed under CC BY-SA 3.0