The part of the script where the error comes is as follows.Win32::OLE(0.1702) error 0x80020011: "Does not support a collection" in METHOD/PROPERTYGET "Hwnd" at c:/AsgReportScripts/dailyscripts/d +ailyreport .pl line xxx
What could be the problem? Thanks in Advanceuse Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); use Win32::OLE; use Win32::OLE::Const; $Win32::OLE::Warn = 3; # die on errors... $file = "C:\\testw.txt"; open (TTT, ">$file") || die "error"; $filename = "C:\\book1.xls"; $filter = 'gif'; # can be GIF, JPG, JPEG or PNG $pngnm = "C:\\test"; eval{ my $Excel = Win32::OLE->new('Excel.Application', 'Quit'); # use the Ex +cel application if it's open, otherwise open new $hwnd = $Excel->{"Hwnd"}; print TTT $hwnd; my $Book = $Excel->Workbooks->Open( $filename ); # open the file foreach my $Sheet (in $Book->Sheets) { # loop through all sheets foreach my $ChartObj (in $Sheet->ChartObjects) { # loop through all chartobjects in the sheet #$datewk = join("".split(/\s+/, $Date)); $savename = "$pngnm" . ".$filter"; #$savename = "$dirpath\\$pngnm" . ".$filter"; # Write image to PNG file $t = $ChartObj->Chart->Export({ FileName => $savename, FilterName => $filter, Interactive => 0 }); } } $Book->Close({SaveChanges=>0}); }; $rrr = Win32::FormatMessage(Win32::GetLastError()); $err = $@; print TTT $err; print TTT "\n $t=> $rrr";
In reply to Win32::OLE(0.1702) error 0x80020011 by Nalina
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |