looking for some solutions? You are welcome.

SOLVED: Word as COM object has no attributes/ability to set attributes


I'm sorry that this is quite alien to me, but I had a previously working script that functioned like the following:

$wd = new-object -comobject word.application

but when I print the COM object it has empty/blank values for all attributes.

PS C:\Users\XXX> $wd

Application                       : 
Creator                           : 
Parent                            : 
Name                              : 
Documents                         : 
Windows                           : 
ActiveDocument                    : 
ActiveWindow                      : 
Selection                         : 

And it cannot set any or perform any functions

PS C:\Users\XXX> $wd.Visible = $true

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: Error loading 
type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))."
At line:1 char:1
+ $wd.Visible = $true
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
    + FullyQualifiedErrorId : ExceptionWhenSetting

I tried browsing related questions but was unable to see if the mistakes are exactly identical. I've run all Windows updates and did a repair installation of Office. (Running Windows 10 and Office 2013)

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots

No comments: