Link to home
Start Free TrialLog in
Avatar of randymiller
randymiller

asked on

Running MSWord from a Windows Service

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")
ASKER CERTIFIED SOLUTION
Avatar of jjardine
jjardine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of randymiller
randymiller

ASKER

J Jardine,

It just ended up changing the dynamics a little.

Word now crashes to the screen with:
Description:
Faulting application winword.exe, version 11.0.8026.0, stamp 4468c5b1, faulting module mso.dll, version 11.0.6568.0, stamp 42e18ef6, debug? 0, fault address 0x0003446c.

Followed by the original error:
Rejected Safe Mode action : Microsoft Office Word.

Thanks for the reply though,

Randy
J Jardine,

all though the answer you gave me didn't do it, the support article reference did the trick.

Turned out the service was automatically created under the administrator account which didn't have a profile setup for it. Once I changed the user all was fine.

Thanks

Randy
I am glad the article worked.