merrymonk ,

From MSDN:

ERROR_MR_MID_NOT_FOUND 317 The system cannot find message text for message number 0x%1 in the message file for %2.

The $en_f = Win32::FormatMessage($en_num); can't provide a string because the text that would be used for that string doesn't exist.

ikegami's suggestion may point to this:

From CPAN:

Win32::CopyFile(FROM, TO, OVERWRITE)

CORE The Win32::CopyFile() function copies an existing file to a new file. All file information like creation time and file attributes will be copied to the new file. However it will not copy the security information. If the destination file already exists it will only be overwritten when the OVERWRITE parameter is true. But even this will not overwrite a read-only file; you have to unlink() it first yourself.

$excel->{DisplayAlerts}=1; I get a message indicating that the file is there and asking if I want to overwrite it.

Looking at the above, I believe the error has to do with an attempt to overwrite an existing file(The very file you have open).

Using the Win32::CopyFile(FROM, TO, OVERWRITE) to allow the overwrite may solve the problem.


In reply to Re: Error 317 saving spreadsheet by Sagacity
in thread Error 317 saving spreadsheet 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.