Documents.Open returns null, running Word automation under ASP.NET on x64
By rickvdbosch
- 1 minutes read - 93 wordsWhen building an ASP application that generates Word documents, it was working fine on the local machine: A Windows XP installation with Office 2007. When we deployed it to windows 2008 (64 bit) and Word 2007 we saw that Documents.Open
returned null. Other than this, there are no exceptions.
The code that returned the error (simplified):
Application app = new Application();
Document doc = app.Documents.Open(ref name);
As it turns out, a 64 bit system stores temporary files in C:\Windows\Sys\WOW64\config\system\profile\Desktop
folder.
The solution:
Create a new directory called “Desktop” inside C:\Windows\Sys\WOW64\config\system\profile
Hope this helps.