On Fri, 08 May 2009, Glenn Linderman wrote:
> So I open a workbook with macros, and then another workbook with data,
> and run A_macro... as follows...
> 
> 
>        require Win32::OLE;
>        require Win32::OLE::Const;
>        Win32::OLE::Const->Load('Microsoft Excel');
>        $Win32::OLE::Warn = 3;
>        $Win32::OLE::Warn = 3;
> 
>        my $Excel = Win32::OLE->new('Excel.Application', 'Quit');
> 
>        my $gl = $Excel->Workbooks->Open(
>       $ENV{'APPDATA'} . "\\Microsoft\\Excel\\XLSTART\\gl.xls");
>        my $Book = $Excel->Workbooks->Open("SomeData.xls");
>        $Excel->Run("gl.xls!A_macro");
>        $Book->Close( 0 );
>        $gl->Close( 0 );
>        $Excel->Close;
> 
> I get an error on the last line:
> 
> Win32::OLE(0.1707) error 0x80020011: "Does not support a collection"
>      in METHOD/PROPERTYGET "" at d:\my\perl\src\roster_data.pl line 3352

Your sample program above doesn't have over 3000 lines, so the error
message and the code don't seem to be related.
 
> Any clues as to what this message means, in this context?  And how I can
> cure it?

I have a suspicion that your program is not running under "use strict".
Could you enable "use strict" and see if the error message changes?

Without "use strict" Win32::OLE will retry some failed method calls
as indexing into unnamed collections instead.  That code exists
solely for backwards compatibility and is generally not desirable.

Cheers,
-Jan

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to