Use -ComObject Word.application without install Word

1

I have a powershell script which use "-ComObject Word.Application". I would like to use this in a windows server but it doesn't have Word. For now, when i execute , i have this error.

New-Object : La récupération de la fabrique de classes COM pour le composant avec le CLSID 
{00000000-0000-0000-0000-000000000000} a échoué en raison de l'erreur 
suivante: 80040154 Classe non enregistrée
(Exception de HRESULT : 0x80040154 (REGDB_E_CLASSNOTREG)).
Au caractère E:\BELAIRREC\Scripts\PowerShell\Doc2PDF.ps1:27 : 16
+     $Wrd     = New-Object -ComObject Word.Application
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ResourceUnavailable: (:) [New-Object], 
COMException
+ FullyQualifiedErrorId : 
NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand

I think it's no doubt because Word is not installed. Is there a way to use -ComObject Word.Application without install Word ?

Thanks

powershell
ms-word
com
asked on Stack Overflow Jun 1, 2018 by Gabriel • edited Jun 1, 2018 by Cindy Meister

2 Answers

3

Depending on what you want to do, you might want to look at the OpenXML SDK, which is a free library from Microsoft that lets you manipulate Office documents without installing the Office products (though the SDK needs to be installed). The Open-XML-PowerTools is an open source collection of cmdlets that make working with the SDK easier.

answered on Stack Overflow Jun 1, 2018 by boxdog
1

Any COM object you call must be installed on the computer.

There is a free Word viewer that you can download from Microsoft but I do not know if it has an exposed COM interface.

answered on Stack Overflow Jun 1, 2018 by Terry Carmen

User contributions licensed under CC BY-SA 3.0