Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Running MSWord from a Windows Service

Posted on 2006-07-06
4
Medium Priority
?
288 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 1500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Screencast - Getting to Know the Pipeline

885 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