Solved

Running MSWord from a Windows Service

Posted on 2006-07-06
4
280 Views
Last Modified: 2008-02-01
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")
0
Comment
Question by:randymiller
  • 2
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
jjardine earned 500 total points
ID: 17053095
Go to Control Panel...Administrative Tools..Services and right click your service.   Click properties and the logon tab. Try checking the box to allow interaction with desktop.   Also, here is an msdn article to give more detail that might help.  http://support.microsoft.com/?id=257757
0
 

Author Comment

by:randymiller
ID: 17053601
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
0
 

Author Comment

by:randymiller
ID: 17054232
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
0
 
LVL 14

Expert Comment

by:jjardine
ID: 17054265
I am glad the article worked.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now