I\'m currently developing a script that takes a Word document, opens it up in Word, and then prints the Word file as a PDF. Everything works great when run manually either on my
I've had problems automating Office from a Windows Service under Windows Server 2008, even though that works fine under Windows Server 2003. The problem also occurs at the Open call, though it actually raises an exception rather than simply returning null. Anyway, you might want to try this...
I tried following the advice given by H Ogawa in this MSDN thread, and it seemed to work. It's bizarre, but kudos to Mr. Ogawa for discovering it.
Summary of the 'Ogawa Hack': create a desktop folder for the system profile, as either
C:\Windows\SysWOW64\config\systemprofile\Desktop
, or
C:\Windows\System32\config\systemprofile\Desktop
...depending on whether you have 64-bit Windows.
Also, the folder needs write permission for whatever user is "driving" Office.
[Edit: corrected link URL]