DaveTheMan has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I want to "copy" a a few cells onto another range and let Excel decide how to do that (i.e. Autofill with xlFillDefault). It is not working in perl. Here's the macro which I've recorded in Excel:
Range("A2:B2").Select Selection.AutoFill Destination:=Range("A2:B17"), Type:=xlFillDefault
And my perl code: (I've copied the relevant syntax from http://code.mincus.com/42/perl-win32ole-excel-selection-texttocolumns/ and think it should be working)
my $excel = Win32::OLE::Strict->new('Excel.Application', 'Quit'); my $workbook = $excel -> Workbooks -> Open("$templfile"); my $sh = $wb -> Worksheets(1) -> {Name}; $sh -> Activate; my $srcrange = 'A2:B2'; my $targrange = 'Range("A2:B17")'; $sh -> Range("$srcrange ") -> Select; my $xlfill = 'xlFillDefault'; $excel -> Selection -> AutoFill({Destination => $targrange, Type => $x +lfill});
What happens is that the "from-range" (A2:B2) gets selected. The AutoFill seems to be ignored (no error message, no action). Any ideas?
Thanks,
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::OLE Excel AutoFill not working
by bobr (Monk) on Dec 23, 2009 at 18:50 UTC | |
by DaveTheMan (Initiate) on Dec 23, 2009 at 20:58 UTC | |
by bobr (Monk) on Dec 24, 2009 at 05:19 UTC | |
by DaveTheMan (Initiate) on Dec 24, 2009 at 14:03 UTC | |
by bobr (Monk) on Dec 24, 2009 at 20:03 UTC | |
by Anonymous Monk on Dec 29, 2009 at 21:12 UTC |