Perl: the Markov chain saw | |
PerlMonks |
Inserting copied rows at another position in Excelby merrymonk (Hermit) |
on Mar 01, 2011 at 10:54 UTC ( [id://890713]=perlquestion: print w/replies, xml ) | Need Help?? |
merrymonk has asked for the wisdom of the Perl Monks concerning the following question:
I am using Excel 2007 on a windows XP PC.
I want to do the following in Perl
1. Select a number of rows 2. Copy these rows 3. Use the 'Insert Copied Rows' to get a copy of the select rows in another position of the spreadsheet I have recorded an Excel VBA to do this and it is (I liked someone describing these as incantations.) I do not think I need the ActiveWindow.SmallScroll Down:=30 because that is just a record of moving to the new insertion point.I have found the following about converting VBA to Perl but it does not seem to really cover this set of actions If you record a macro in Microsoft Office, this can often be translated directly into Perl. In Visual Basic for Applications (VBA) the syntax is like this: object.method(argument).property = value In Perl this becomes object->method(argument)->{property} = value; So for example this code from VBA: ActiveChart.Axes(xlCategory, xlPrimary).CategoryType = xlCategoryScale becomes this in Perl: $Chart->Axes(xlCategory, xlPrimary)->{CategoryType} = xlCategoryScale; Below is the Perl code where I opened an existing spreadsheet and tried insert a number of copied rows The print for $selection gave OLE=HASH(0x183fab8) However, it gave a failure on the last line which said Can't call method "Insert" on an undefined value at insert_rows.pl line 16. What change do I have to make to be able to copy the rows that I want?
Back to
Seekers of Perl Wisdom
|
|