S_a_k_Uの日記みたいなDB

~サクゥーと呼ばないで~

DCOMで開いたWord.Documentオブジェクトがnullになる

DCOM使ってWordファイルを操作するVBのEXEがある。
コマンドプロンプトから実行すると、問題なくWord.Documentオブジェクトが開けるらしい。
ところが、WebSphereのWebアプリケーション(JavaのRuntime.getRuntime().exec())から実行すると、Word.Documentオブジェクトが開けない(=nullになる)らしい。

Set wdApp = New Word.Application
Set wdDocs = wdApp.Documents
Set wdDoc = wdDocs.Open(FilePath)  ' wdDocがnullになる

Dcomcnfg.exe を使用してアクセス セキュリティを設定する

c# - Interop.Word Documents.Open is null - Stack Overflow

If you are still looking for the answer I have found it just a moment ago for my project.
Open DCOM Config Settings:
Start -> dcomcnfg.exe
Computer
Local Computer
Config DCOM
Search for Microsoft Word 97-2003 Documents -> Properties
Tab Identity, change from Launching User to Interactive User

IDタブの「起動ユーザー」を「対話ユーザー」に変更しろって書いてあるけど、ユーザーをAdministratorに指定することで解決したらしい。