Abid
Abid

Reputation: 690

Word interop: Visible always false

I try to open word like following:

Word.Application app = new Word.Application();
app.Visible = true;
Console.WriteLine($"Visible {app.Visible}");

When running this code on my development machine (Windows 10, Office 365), Word appears (as expected) and output is:

Visible: true

When running this code on the production machine (Windows Server 2019, Word 2019), Word does not appear and output is:

Visible: false

There must be some issue on the production machine as everything went well until a week ago.

Windows event log doesn't show anything that points to this issue. Re-installing Word didn't help. When starting Word manually, it starts normal and appears as expected.

Does anybody know how to investigate further or what the cause of this issue could be?

EDIT Whey I modify the code like this:

Word.Application app = new Word.Application();
app.Visible = true;
app.Activate(); // System.Runtime.InteropServices.COMException

... I get an Exception:

Anwendung kann nicht aktiviert werden. HRESULT:0x800A11F9

I found the following article COM Exception 0x800A11F9 - Cannot activate application but this doesn't provide a solution. HRESULT:0x800A11F9

I run the application as administrator.

Upvotes: 1

Views: 677

Answers (1)

Abid
Abid

Reputation: 690

I finally solved the issue.

Another application changed the Word security settings in dcomcnfg.

I changed the settings to the following (German / English):

  • General: Authentifizierungsebene: Keine / Authentication level: None

  • Security: choose Settings for all points and give all rights to Administrators/Remotedesktop user (the production server acts as terminal server)

  • Identity: Option Der Benutzer, der die Anwendung startet. / The user who started the application.

In dcomcnfg, Word isn't listed by name but by AppId. To find out, which AppId Word does have, I found this article which states

Look for HKEY_CLASSES_ROOT\CLSID{00020906-0000-0000-C000-000000000046}

Upvotes: 2

Related Questions