jarlakhnet has asked for the wisdom of the Perl Monks concerning the following question:

I am using win32::Ole module to activate the excel application in the CGI mode, during this process, I found and error saying Win32::OLE(0.1403) error 0x80070005: "Access is denied" at ...... line 7 but when i Tried to access the file on the Command Prompt the result was good.
#!C:/Perl/bin/perl.exe use strict; sub Export_Excel{ use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; # die on errors... my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); my $Book = $Excel->Workbooks->Open("D:\\Application\\tmp\\Report_Temp. +xls"); my $Sheet = $Book->Worksheets('Report_Temp'); $Sheet->Cells(15,2)->{'Value'}=''; $Sheet->Cells(15,1)->{'Value'}='Test Successfully'; $Book->Save(); $Book->Close; $Excel->quit(); }
Here the File(Report_Temp.xls) was written by another Script using the Spreadsheet::WriteExcel module, Now I want to use Win32::Ole to write a sample data in the respective file, So I will call the above subroutine to invoke it but it throws the above error.
I Believe the Access denied is due to Permission provided to the Directory or File Created. In Unix machine we can change the permission by using the command "chmod" to the created file, Since I am using the win32 Perl with Apache running under Windows2003.I tried the above command in my script but it doesnt change the permissions.
I Searched for the "group" in the httpd.conf, But I am not able to find in it.
I am not much aware of WebServer Configuration, the File or Directory Permissions using perl or OLE and I have spent long hours trying to find the solution. Please Detail Explain is appreciated.

Replies are listed 'Best First'.
Re: Problem with Win32::OLE in the CGI Mode
by Amar (Sexton) on Nov 07, 2005 at 15:10 UTC
    When run on a command prompt script runs with local user permission.
    The same script when run from a browser runs as user IUSR_<<computer_name>>. This user being a guest account user doesnot have permission to work with processes.
    Try giving IUSR account full permissions. This is the scenario with IIS. I hope a similar thing exists with Apache. Give it a try.

    ****Giving IUSR account, full permissions is not recommended*****

    Regards
    -Amar
Re: Problem with Win32::OLE in the CGI Mode
by Anonymous Monk on Jan 17, 2006 at 14:26 UTC
    Check permissions on the DCOM service running, I had a similar error and that fixed it up. As the previous post mentioned, the permissions will apply to the guest user but that will depend on the type of access set up for IIS. It could be that the user logs in on his/her windows account. Hope that helps.

    Rob