in reply to Open an excel file using win32::ole module

I'm guessing a bit here, so don't be surprised if I get this wrong. I think it's to do with the doubled backslashes in your file name. Because you are using single quotes, escaping doesn't happen and the literal string is used as the path. Since Losedows can't support unnamed directories (between the pairs of backslashes), it can't find your file. Because you have specified the 'Quit' option when you create the Excel instance, this closes Excel when the code exits. This happens when you open or die. Try (a) single backslashes or double quotes, (b) removing the "quit" option, (c) not dying. If none of these work (or give you the clues to getting it to work), please tell us what happened.

Regards,

John Davies

  • Comment on Re: Open an excel file using win32::ole module

Replies are listed 'Best First'.
Re^2: Open an excel file using win32::ole module
by Anonymous Monk on Aug 12, 2014 at 13:49 UTC
    Because you are using single quotes, escaping doesn't happen and the literal string is used as the path.

    perldata:

    String literals are usually delimited by either single or double quotes. They work much like quotes in the standard Unix shells: double-quoted string literals are subject to backslash and variable substitution; single-quoted strings are not (except for \' and \\).

    Or just test it:

    $ perl -wMstrict my $excelfile = 'd:\\test\\Korea_Checklist.xls'; print "$excelfile\n"; __END__ d:\test\Korea_Checklist.xls