Solved

Running MSWord from a Windows Service

Posted on 2006-07-06
4
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

756 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