Hi fellow monks, today I have spent some time trying to transponate a range (2D-grid) in Excel.
I have followed the usual(?) procedure to record a macro in excel doing the operation and then converting the VBA-code to perl

The line that does the actual transpose look like this

$sheet->Cells(10,5)->PasteSpecial( {Paste => xlAll, Operation => xlNone, SkipBlanks => 0, Transpose => 1 });
This results in the following errormessage from Win32::OLE
OLE exception from "Microsoft Excel": Could not find PasteSpecial property for the Range class Win32::OLE(0.15) error 0x80020009: "Exception occured" in METHOD/PROPERTYGET "PasteSpecial" at cp2.pl line 31

I get the same errormessage when I invoke the function with the more standard call approach

$sheet->Cells(10,5)->PasteSpecial(xlAll, xlNone, 0, 1);
HOWEVER when I skip the fourth argument, "Transpose", thing work OK except that no transposition is done as the argument defaults to false

Any ideas someone??


In reply to Troubles transposing a range in Excel with Win32::OLE by guha

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.