Running MSWord from a Windows Service
Posted on 2006-07-06
I have a program written in vb.net that opens a word document using office automation, does a global find and replace then saves the program with a new name.
When I convert the program to a windows service, it starts fine, but fails when it goes to start word. WINWORD.EXE starts, but no code after that point is processed. I have verifed this by writing to the event log before and after the start word line. The first log is written, the second one does not.
There is an error logged in the even view by Microsoft Office 11, stating: "Rejected Safe Mode action: Microsoft Office Word." I have tried setting the macro security to low, but it has no affect.
Do I just need to tweek a setting to get it to work, of will word not run like this.
PS: This is the last line of code to run:
wordApp = CreateObject("Word.Application")