Hello, At the bottom is my is my entire code. Ofcourse all it does is get data out of a Lotus Notes server and dump it into excel. If you see the last lines I want to change the column width of a column in Excel......... and that doesn't happen!
Regards Saadat Saeed use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); my $cw; my $fp; my $i; my $dbDir; my $Cell; my $Notes = Win32::OLE->new('ServerName') or die "Cannot start Lotus Notes Session object.\n"; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application'); $Excel->{Visible} = 1; my $Book = $Excel->Workbooks->New; my $Book = $Excel->Workbooks->Add; my $Sheet = $Book->Worksheets(1); my $Range = $Sheet->Range("A1:D1"); $Range->{Value} = [['FileName','Title','Size','Quota']]; $i = 2; $dbDir = $Notes->GetDbDirectory("ABB_AE01_HUB01/AE01/ABB"); my $db1 = $dbDir->GetFirstDatabase(1247); while ($db1) { $_ = $db1->{FilePath}; #chomp $fp; if ( /^Mail/ ) { print "file path $_\n"; $Range = $Sheet->Range("A$i:D$i"); $Range->{Value} = [[$db1->{FilePath},$db1->{Title},$db1->{Size},$db1->{SizeQuota}*1000]]; $Range = $Sheet->Range("E$i"); #$Range->FormatConditions -> Add("xlExpression",,"=(C$i/D$i)<1"); $Range->Interior->{ColorIndex} = 36; #$Range->FormatConditions->Add({Type}->xlExpression,{Formula1}->"(C$i/D$i)<1"); #$Range->FormatConditions(1)->Interior->{ColorIndex} => 36; $i = $i+1; }; $db1 = $dbDir->GetNextDatabase; } #$Range = $Sheet->Range("A1:D1"); #my @columnheaders = qw(A:B); # foreach my $Range(@columnheaders){ # $Sheet->Columns($Range)->AutoFit(); # } $Range = $Sheet->Range("E1"); #my @columnheaders = qw(A:B); # foreach my $Range(@columnheaders){ with ($Sheet->Columns($Range), ColumnWidth => 5); __________________________________ Do you Yahoo!? Yahoo! Search - Find what you’re looking for faster http://search.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>