in reply to Win32::OLE error 0x80070005: Access is denied

If you run your Perl script from the command line, does it run ok? i.e. is it just that it doesn't work when called through a browser?

If that's the case, then it's likely to be permissions related, e.g. check that the IUSR_machinename account has execute permissions and that it has write access to any temporary files you use. You may also want to check that in IIS, you have enabled scripts + executables permissions on your website / virtual directories.

A quick super search showed up a similar case from not so long ago: win32::ole runs under cmd line but not cgi, perhaps some of the hints there may help?

  • Comment on Re: Win32::OLE(0.1403) error 0x80070005: "Access is denied"

Replies are listed 'Best First'.
Re^2: Win32::OLE(0.1403) error 0x80070005: "Access is denied"
by jarlakhnet (Novice) on Nov 03, 2005 at 12:11 UTC
    Thanks puploki

    As you said my script is not running properly in commnad line, but where as I am running my application in Apache not in IIS , so Explain me briefly how to handle this

      In the node I mentioned in my first post, I think that's Apache not IIS - did you take a look at it?

      I assume the same comments apply - check that the user Apache runs as has all the relevant permissions. I'm also not quite clear from your reply whether running your script outside of Apache works or not - if it doesn't then I'd say you need to fix that before addressing any problems with running it via CGI.

        Hi Below is the code I tried to run under the command Prompt.
        #!C:/Perl/bin/perl.exe # use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); my $Book = $Excel->Workbooks->Open("D:\\tmp\\Temp.xls"); $Book->Close; $Excel->quit();
        Hi
        Below is the code I tried to run under the command Prompt.
        #!C:/Perl/bin/perl.exe # use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); my $Book = $Excel->Workbooks->Open("D:\\tmp\\Temp.xls"); $Book->Close; $Excel->quit();
        FYI the code is working in my sytem windows XP, but its not working in the windows 2003 server. where as in server the access is denied error occurs so please provied me a soultion.
        #!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(); }
        I will be calling the above subroutine in my program. It works fine in the command line prompt, while accessing thru the CGI script I found the above error. I Believe I have to provide some User Permissions to the Excel Application thru CGI, b'cos the error throws the line pointing to the Excel Object Creation. So please Help me in this issue
        I run the script in the command line its running fine, When I tried run thru CGI It throws an error. Whether I have to provide any user rights in the Server or Webserver for accessing my Excel application thru cgi. Since I am new to these stuffs, Please Explain me briefly.