Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15162

VS 2019 Unable to cast COM object, MSWord

$
0
0
Just trying to sort an early binding issue with MSWord, created from a Winform.
Code works as expected on Client machine but not on dev machine.

It works fine if late binding

Error:
Code:

An unhandled exception of type 'System.InvalidCastException' occurred in PTApplication.exe
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:      Interface not registered (Of Exception from HRESULT: 0x80040155).

Steps
-Googled
-Appears to be registry problem with various previous Office installs
-Tried recommended reg fixes, same issue
- Removed Office, ran Microsoft repair tool to remove ALL traces of Office
- Reinstalled Office365
- Same issue exists.
- Removed analyzer for Microsoft.Office.Interop.Word
- Added current version (although it showed it was the same version)
- Rebuilt and ran code, same error
- Checked registry once more, IID 00020970 does not exist, actual IID 00020905
Actual path: Computer\HKEY_CLASSES_ROOT\TypeLib\{00020905-0000-0000-C000-000000000046}\8.7

If I am correct, the issue appears to be analyzer pointing to wrong registry entry or an old reference still being used in code?

Any suggestions as to what would change the COM component call to the right entry?

Error images:
Name:  Untitled1.jpg
Views: 55
Size:  42.3 KBName:  Untitled2.jpg
Views: 53
Size:  10.9 KBName:  Untitled3.png
Views: 54
Size:  19.1 KB
Attached Images
   

Viewing all articles
Browse latest Browse all 15162

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>