Excel automation from a Windows service

R

rampduck

Hi, I have a service (written in C++) that periodically opens up an
excel spreadsheet, re-calculates the values, saves it to a new
location and then prints it.

This all worked pretty well on Windows Server 2003 with Office 2003,
but on Windows Server 2008 with Office 2007 I get the following error
when I attempt to open the excel spreadsheet: Microsoft Office Excel
cannot access the file

I have done a bit of searching on the net and found that changing the
dcom Identity information of the Microsoft Excel Application to
anything other than "The launching user" resolves the problem but
unfortunately it causes a bunch of new problems.

If I change the identity to "The interactive user", the service works
well but only if someone is logged onto the OS which I guess is to be
expected as once no one is logged on to Windows there is no
"Interactive user". If on the other hand I change the identity to
"This user" and specify the user that the services runs under (local
user) then the service works well regardless of whether someone is
logged on to Windows or not. But it is no longer possible for the
user to use Excel manually.

Whilst both of the above options are improvements over nothing
working, neither is ideal. During my reading I found an article
detailing alternative methods (http://www.kbalertz.com/Feedback.aspx?
kbNumber=257757) to excel automation. But none of them seem
applicable to what I am trying to achieve.

Does anyone have any suggestions on how to get my current service to
run regardless of whether anyone is logged on to Windows, whilst also
allowing Excel to be manually operated by the user? If not I am open
to alternative solutions to achieve my goal (periodically open
spreadsheet, re-calculate, save to new location).


Thanks very much for any help you can provide.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top