그래서 PowerShell을 사용하여 Excel 파일을 열려고합니다. 그러나 "이 통합 문서 클래스의 열린 속성을 가져올 수 없습니다"라는 오류 메시지가 나타납니다.
$dirPath = ("C:\Users\localadmin\OneDrive\DailyReports\")
$manFile = Get-ChildItem -Path $dirPath -Recurse -Filter "*MANSUM*"
$manPath = $manFile.Fullname
$excel = New-Object -ComObject Excel.Application
$excel.DisplayAlerts = $false
$manWB = $excel.Workbooks.Open($manPath)
이 오류를 어떻게 해결할 수 있습니까?
전체 경로 ( $manPath)가 정확합니다.
Windows 10 Pro, Excel 2016 실행
Get-ChildItem해야 할 점 은 파일 이름에 대한 필터가 특별히 Excel 파일을 가리켜 야하므로$manFile = Get-ChildItem -Path $dirPath -Recurse -Filter "*MANSUM*.xlsx"예를 들어 시도 하고 도움이되는지 확인하십시오.