I am trying to convert Word file(s) to PDF. I have found a code that is using ComObject Word.Application. However, running the command: $word = New-Object -ComObject word.application returns the following error:
`New-Object : Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). At line:1 char:9
- $word = New-Object -ComObject word.application
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException
- FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand`
I have MS Word installed and running fine. I have found that my PowerShell is running 64-bit version but my Office installed as 32-bit. This may be an issue but I cannot control it as the script will be powered by 3rd party application that I have no control over and Office is installed on many computers that I really do not control also. Can I somehow register that Class? Can I do the conversion without any 3rd party software (like Word or LibreOffice) installed? Any other suggestions?
Thanks
Need to create a PDF file