I have code that uses Interop to create Word documents from within a VS2005 web application. My code either creates a document or opens an existing document in Microsoft Word 2003 to enable a user to make changes and save it.
This all works fine from my development laptop, however when I copy the site to our web server, I have an issue. Initially I got access permission errors but after changing security permission on the DCOM Microsoft Word Document, I got past this. However, now when I run the code from the server, Word never opens to the user. There are instances of winword.exe in the task manager, but the application never opens.
Here's a section of my code that creates a Word document based on a template:
Dim word As New Microsoft.Office.Interop.Word.Application
Dim wobj As Microsoft.Office.Interop.Word.Document
word.Activate()
Try
wobj = word.Documents.Add(fname)
wobj.Activate()
With word
.Visible = True
.Activate()
.ChangeFileOpenDirectory("c:\Proposal\")
.ActiveDocument.SaveAs(sName)
End With
I then go on to replace bookmarks, make other changes and then save the document again.
Once again, when I run my site on my development laptop in VS2005, it all works perfectly. My primary problem is that an instance of Word never opens up to be visible to the user.
This all works fine from my development laptop, however when I copy the site to our web server, I have an issue. Initially I got access permission errors but after changing security permission on the DCOM Microsoft Word Document, I got past this. However, now when I run the code from the server, Word never opens to the user. There are instances of winword.exe in the task manager, but the application never opens.
Here's a section of my code that creates a Word document based on a template:
Dim word As New Microsoft.Office.Interop.Word.Application
Dim wobj As Microsoft.Office.Interop.Word.Document
word.Activate()
Try
wobj = word.Documents.Add(fname)
wobj.Activate()
With word
.Visible = True
.Activate()
.ChangeFileOpenDirectory("c:\Proposal\")
.ActiveDocument.SaveAs(sName)
End With
I then go on to replace bookmarks, make other changes and then save the document again.
Once again, when I run my site on my development laptop in VS2005, it all works perfectly. My primary problem is that an instance of Word never opens up to be visible to the user.