I'm using a servic to periodically check a directory and Print to PDF any Word docs that get put there. This all worked fine on server 2003 with word xp. Now I'm using Server 2008 and Word 2007 and keep getting the same error. It works fine as an app, but fails as a service with: "This command is not available because no document is open"
Code below.
Imports Word = Microsoft.Office.Interop.Word
____________
Dim
wa = New Word.Application
Dim wd As Word.Document = wa.Documents.Open("c:\test.doc", False, True, False)
If Not wd Is Nothing Then wd.Activate()
wa.ActivePrinter = "CutePDF Writer"
wa.ActiveDocument.PrintOut(False)
wd.Close(False)