I am having trouble saving an Excel spreadsheet. With Perl I take the steps
1. Take a copy of a spreadhsheet that has some cells already filled in
2. Use this copied file with
$excel = Win32::OLE->new('Excel.Application', 'Quit'); $workbook = $excel->Workbooks->Open<copied file name>) $worksheet = $excel->ActiveWorkbook->Worksheets(“sheet1”);
3. Fill in the data I need
4. Try and save the edited copy of the spreadsheet with
$excel->Workbooks(1)->SaveAs(<copied file name>) or ($excel_res = 0, + $ew_message = "Could not save spreadsheet <copied file name>); $en_num = Win32::GetLastError(); $en_err = "message <" . Win32::FormatMessage($en_num) . "> number <" . + $en_num . ">"; $ew_message = "<" . $ew_message . "> is just after saving part file\n" + . "system error text <$en_err>\n";
The MSDOS screen gives the following contents for $ew_message
<Could not save spreadsheet <copied file name> is just after saving part file system error text <message <> number <317>>
I also get an Excel message saying Do want to save the changes you made to <copied file name> with three buttons for Save, Don’t Save and Cancel.
If I open the copied spreadsheet (before I use any of the message buttons) I get the message that the file is Locked for Editing.
If I use the Save button I get the edited spreadsheet that I want.
What changes do I have to make so that the spreadsheet will be saved as I would like it to?

In reply to Excel SaveAS problem by merrymonk

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.