in reply to Re^3: Win32::OLE Excel AutoFill not working
in thread Win32::OLE Excel AutoFill not working

I think Selection is a property of Excel, at least that's what the Object Browser says.

Your code is working, and it is also showing what I believe was the real problem: Range() is a property of Excel and Worksheet, but I need to refer to the Range of the Worksheet when I want to use AutoFill.

Thus, this code works, too:
$sh -> Range('A2:B2') -> Select; $excel -> Selection -> AutoFill({Destination => $sh->Range('A2:B2'), T +ype => xlFillDefault});
Thank you very much for the help, Roman!

Regards,
Dave

Replies are listed 'Best First'.
Re^5: Win32::OLE Excel AutoFill not working
by bobr (Monk) on Dec 24, 2009 at 20:03 UTC
    Glad to hear that you moved forward. Apparently I was wrong in my assumption about Selection, however I think it must then refer to activecell in current workbook/worksheet.

    I generally try to avoid using Selection, usually just create couple of Range objects and call methods/write data using them. OLE interface has quite large call overhead, so minimizing number of operations can significantly speedup your app.

    -- Roman