Solved

Running MSWord from a Windows Service

Posted on 2006-07-06
4
281 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create XML 5 46
SQL syntax in VB.net 5 30
Allow user to hide and show datagridview columns 4 17
Crystal reports vb.net 2 7
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…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

23 Experts available now in Live!

Get 1:1 Help Now