I am trying to copy data from one spreadsheet to another. The data in spreadheet A is derived from a formula so I want SpreadsheetB to copy just the values and not drag along the formula with it.

I set up a macro which I am now trying to convert into perl

  1. Range("N10").Select
  2. Selection.Copy
  3. Range("G13").Select
  4. Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

I am ok with everything except or line 4.

Below is my code:

$excel = CreateObject OLE "Excel.Application" || die "CreateObject : $ +!\n"; $excel -> {Visible}=1; $excelfile2 = $excel -> Workbooks -> Open("c:\\sheetA.xls"); $excelfile = $excel -> Workbooks -> Open("c:\\sheetB.xls"); $xls4 = $excelfile -> Worksheets(1); $xls5 = $excelfile2 -> Worksheets(1); $xls5 -> Range ("H58:H105") -> Copy; $xls4 -> Cells (9, 15) -> {PasteSpecial} ="Paste=xlValues, Operation=x +lNone, SkipBlanks=False, Transpose=False"; $xls4 -> Cells (9, 14) -> Select;

Everything works ok except for the Paste = xlValues. The data is pasted in the right column put it still shows the link to SheetA.xls rather than just the value.

I need to do things this way as I have to send SheetB.xls to peole who wont have a copy of SheetA.xls and I don't want excel to warn about links to another spreadheet when SheetB.xls is opened

Can someone pleeeassssssseeeeeee HELP me

Toni

Edited by footpad, ~Thu Nov 29 05:38:14 2001 (GMT)


In reply to excel pasting by toni_t_banire@gsk.com

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.