Excel Service Problem

F

Flavio

Hi People!

I have developed at some time ago an application that runs as windows
service. Now i've to integrate this application with Excel... Until here no
problem...
The problem begin when i try to access the Excel application object
Activex, when the application is running as service. The excel runs the
installation wizard, as if it need some plugin or library that is not
installed. The observation is that the Office (2000/ XP/ 2003) is installed
seted up as complete (all the software possible). And the wizard belongs to
appear ever time i use the integration from the software (in service mode).
The service has the flag marked as "Allow Interactions with desktop".
Any ideia how i can mitigate the problem, maintainning the application
as windows service and accessing the Excel????
The problem that occur, is at the moment that the excel object, is
instancied, appears a wizard to the user that is logged on, that require a
".cab" file to be installed, this file is from the MS Office installation CD.
It ever happen if the MS Office is installed completely Full.
And the more estrange, is that if i run this application as a user
application, it interact with excel, without any problem, and when a put this
application to run as service, this problem apper.
Bellow i post a piece of the code, that interact with excel:

// Instantiate Excel and start a new workbook.
_Application objApp;

objApp.CreateDispatch("Excel.Application");
Workbooks objBooks = objApp.GetWorkbooks();

std::string filename = "";
if (!this->excelCfg.workSheet.useFileLocally)
{
filename += this->WorkOrLocalDir().c_str();
filename += "\\";
}
filename += this->excelCfg.workSheet.filename;

// Open file (create if failed)
_Workbook workbook = objBooks.Open(filename.c_str(), VOptional,
VOptional, VOptional, VOptional, VOptional, VOptional, VOptional,
VOptional, VOptional, VOptional, VOptional, VOptional);

Worksheets objSheets = workbook.GetWorksheets();

workbook.SetSaved(true);
objApp.Quit();
 

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