in reply to OLE & Excel
with(OBJECT, PROPERTYNAME => VALUE, ...)
What you need is a better understanding of Excel's object model and how to translate the VB model into Perl.
Columns is a collection of Column objects. It applies to a Range object, a Worksheet, or the Application object. Being a collection, a single column object can be referenced by name or by index - but not by a Range object. You have a range, you want the first column in $Range, like so:
with ($Range->Columns(1), ColumnWidth => 1)
Or you want the column "E:E" on $Sheet: $Sheet->Columns('E:E')....
By the way, I wouldn't even use the "with". Just assign the column width directly:
$Sheet->Columns('E:E')->ColumnWidth = 15;
You may find cacharbe's Using Win32::OLE and Excel - Tips and Tricks helpful in converting from VBA to perl.
Hope this helps
|
|---|