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

I am trying to create a button/image on my cgi page that will run a specific piece of code that generates an output to excel, while not changing pages. What I have come up with is using a submit button that self posts using hidden values required to load the same page while adding an additional hidden value. This additional hidden value I thought could be used as a flag.
if ($query->param('excel')){ &myexcelsubroutine } sub myexcelsubroutine { my $application = Win32::OLE->new("Excel.Application"); my $workbook = $application->Workbooks->Add; $application->{Visible} = 1; my $worksheet = $workbook->Worksheets(1); etc etc }
Is this a possible technique for achieving my goal. Why is there no Excel generation occuring when i activiate the submit button. My excel code works perfectly when run from the command prompt in a seperate script.

Thankyou soo much to anyone who offers any advise

Replies are listed 'Best First'.
Re: Calling Win::OLE subroutine
by diotalevi (Canon) on Sep 08, 2004 at 22:47 UTC
    The server must also have Excel installed since that is where the script is run by the web server.
Re: Calling Win::OLE subroutine
by sandfly (Beadle) on Sep 08, 2004 at 22:48 UTC
    I don't see why this shouldn't work... except for the obvious limitation: the CGI script will execute on the server, not on the client PC, unless they are one and the same. I.e. Excel will pop up on the web server (assuming it's a Win32 box with office installed).