Forum Discussion

TroySupport's avatar
TroySupport
Copper Contributor
Feb 16, 2021

Word automation - Element not found

I have a PowerShell script running on Windows 10 (fully patched) with Office 365. On my PC, the lines

$word = New-Object -comobject Word.Application
$word.Visible = $false

fail on the second line with:

Exception setting "Visible": "Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'. This operation failed because the QueryInterface call on the COM component for
the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND))."

And the $word object is empty.

This used to work and if I run the same script on a Windows 10 (fully patched) VM with another licence to the same Office 365 subscription, it works. Is there some Word setting I need to change?

No RepliesBe the first to reply

Resources