How to fix this problem "Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))"

0

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
excel
powershell
asked on Stack Overflow Jun 11, 2019 by fikos • edited Jun 11, 2019 by Ansgar Wiechers

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0