Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

PowerShell: unable to get the open property of the workbooks class

Writer Andrew Mclaughlin

So I try to open an Excel file with PowerShell. But I got this error message: "unable to get the open property of the workbooks class".

$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)

How can I fix this error?

The full path ($manPath) is correct.

Running Windows 10 Pro, Excel 2016

1

1 Answer

Here's a solution:

Need to create folder and provide proper access rights.

・Windows 2008 Server x64

Please make this folder.

C:\Windows\SysWOW64\config\systemprofile\Desktop

・Windows 2008 Server x86

Please make this folder.

C:\Windows\System32\config\systemprofile\Desktop

Refer:

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy