Hi, I've recently written my first script to take form data and update the stats for a squash ladder here at my university. When I test it out on my computer (both at work (XP) and at home(98)) using Xerver as the web server everything runs fine. But I brought it over to my colleague's computer today, he's using Win2000 with just the IIS or something or other as his web server and it can't open the excel spreadsheet with the data, and when it did manage to open the file it couldn't use the form data for some reason... Here is the code I was using:
#use strict; use Win32::OLE::Const 'Microsoft Excel'; use CGI; #get the data from the form my $q = new CGI; my $matchDay = $q->param(matchDay); my $matchMonth = $q->param(matchMonth); my $matchYear = $q->param(matchYear); my $challenger = $q->param(challenger); my $cRow = $q->param(cRow); my $opponent = $q->param(opponent); my $oRow = $q->param(oRow); my $g1c = $q->param(g1c); my $g1o = $q->param(g1o); my $g2c = $q->param(g2c); my $g2o = $q->param(g2o); my $g3c = $q->param(g3c); my $g3o = $q->param(g3o); my $g4c = $q->param(g4c); my $g4o = $q->param(g4o); my $g5c = $q->param(g5c); my $g5o = $q->param(g5o); #open excel my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32: +:OLE->new('Excel.Application', 'Quit'); #open the spreadsheet... used to use visible=1 for my own #editing purposes $Excel->{'Visible'}=0; my $book = $Excel->Workbooks->Open("D:\\andreas\\perl\\squash.xls") || + die("Unable to open document ", Win32::OLE->LastError()); #add a temporary sheet to stick the form data (Sheet1) by #default my $worksheet = $book->Worksheets->Add; $worksheet->Range(A1)->{'value'} = $matchDay; $worksheet->Range(A2)->{'value'} = $matchMonth; $worksheet->Range(A3)->{'value'} = $matchYear; $worksheet->Range(A4)->{'value'} = $challenger; $worksheet->Range(A5)->{'value'} = $cRow; $worksheet->Range(A6)->{'value'} = $opponent; $worksheet->Range(A7)->{'value'} = $oRow; $worksheet->Range(A8)->{'value'} = $g1c; $worksheet->Range(A9)->{'value'} = $g1o; $worksheet->Range(A10)->{'value'} = $g2c; $worksheet->Range(A11)->{'value'} = $g2o; $worksheet->Range(A12)->{'value'} = $g3c; $worksheet->Range(A13)->{'value'} = $g3o; $worksheet->Range(A14)->{'value'} = $g4c; $worksheet->Range(A15)->{'value'} = $g4o; $worksheet->Range(A16)->{'value'} = $g5c; $worksheet->Range(A17)->{'value'} = $g5o; #run excel macros that adds the new data $Excel->Run("Start"); #remove the temporary sheet $Excel->{'DisplayAlerts'}=False; $worksheet->Delete; $Excel->{'DisplayAlerts'}=True; #run the macro in excel that generates the rankings my $worksheet = $book->Worksheets("Summary"); $worksheet->Select; $Excel->Run("updateStats"); $book->Save; $book->Close;
I understand that I will probably have to add in some extra things to stop malicious use or whatever but I'm just trying to get this part to work first. Thanks, Andreas

In reply to Script works on WinXp & win98 but not Win2000 by Jargo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.