If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > No type library matching "Microsoft Excel" found

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Dec 2007
Posts: 1
No type library matching "Microsoft Excel" found

Hello All,

I am newbee for perl scripting. I am writing a script to update an excel sheet daily. MyScript:
================================================== ========
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';

$Win32::OLE::Warn = 3; # die on errors...

# get already active Excel application or open new
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
|| Win32::OLE->new('Excel.Application', 'Quit');

# open Excel file
my $workbook = $Excel->Workbooks->Open("E:\\poolsize_BLRKCF9A_1.xls");

my $worksheet = $workbook->Worksheets(1);
my $LastRow = $worksheet->UsedRange->Find({What=>"*",
SearchDirection=>xlPrevious,
SearchOrder=>xlByRows})->{Row};
print "\nmmmmm = $LastRow";

$datetime=localtime();

# $count variable is used to track the no of in the excel
$count=0;

#$loc=$ENV{"TEMP"};
#$loc="D:\\VOBSpaceUsage";
$vob="";
$vobsize=0;
$totalvobsize+=0;
$vd="";
$sum=0;


#$worksheet->write($count,0,"Updated on $datetime",$format);
#$worksheet->write($count,1,"VOB Name",$format);
#$worksheet->write($count,2,"db",$format);
#$worksheet->write($count,3,"cdft",$format);
#$worksheet->write($count,4,"ddft",$format);
#$worksheet->write($count,5,"sdft",$format);
#$worksheet->write($count,6,"Total Size in (MB)",$format);
#$worksheet->write($count,7,"Total VOB Size in (GB)",$format);

#@vobs = `ct lsvob -s -host blrkcf9a`;

@vobs= ("\\AXIS");

foreach $vob (@vobs)
{

$vobname=$vob;
chomp($vobname);

#chop($vobname);
print "\n VOB Name :: $vobname \n";
@vobdiskuse = `cleartool space -vob -update $vob`;
foreach $vd (@vobdiskuse)
{

if ($vd =~ /VOB database/)
{
if ($vd =~ /(\d+\.\d+)\s+/)
{
$dbsize = $1;
# print "\n DB Pool:$dbsize Mb\n";
}
}
if ($vd =~ /cleartext/)
{
if ($vd =~ /(\d+\.\d+)\s+/)
{
$csize = $1;
# print "\n C Pool:$csize Mb\n";
}

}
if ($vd =~ /derived object/)
{
if ($vd =~ /(\d+\.\d+)\s+/)
{
$dosize = $1;
# print "\n DO Pool:$dosize Mb\n";
}
}
if ($vd =~ /source pool/)
{
if ($vd =~ /(\d+\.\d+)\s+/)
{
$srcsize = $1;
# print "\n SOURCE Pool:$srcsize Mb\n";
}

}

if ($vd=~ /^Total*/)
{
chomp($vd);

if ($vd=~ /\s(\d+\.\d+)\s/)
{
$vobsize=$1;
chomp($vobsize);
# print "VOB Size :: $vobsize \n";

$row = $LastRow+1;
#$worksheet->Cells($row,1)->{'Value'}= $vobname;
#$worksheet->Cells($row,2)->{'Value'}= $dbsize;
#$worksheet->Cells($row,3)->{'Value'}= $csize;
#$worksheet->Cells($row,4)->{'Value'}= $dosize;
#$worksheet->Cells($row,5)->{'Value'}= $srcsize;
#$worksheet->Cells($row,6)->{'Value'}= $vobsize;
}
$totalvobsize+=$vobsize;
$totalvobsize = ($totalvobsize / 1024);
$sum+=$totalvobsize;
print "\nTotal Vobsize: $totalvobsize GB \n";
#$worksheet->Cells($row,7)->{'Value'}= $totalvobsize;
}
}
$row++;
}
#$worksheet->Cells($row,7)->{'Value'}=$sum;

$workbook->Close;

================================================== ========

I am getting the following error:

D:\admin\perl_scr>perl spaceusage_excel_pools2.pl
No type library matching "Microsoft Excel" found at spaceusage_excel_pools2.pl line 2
Win32::OLE(0.1701): GetOleTypeLibObject() Not a Win32::OLE::TypeLib object at C:/Perl/site/lib/Win32
/OLE/Const.pm line 45.
Win32::OLE(0.1701) error 0x800401f3: "Invalid class string" at spaceusage_excel_pools2.pl line 7
eval {...} called at spaceusage_excel_pools2.pl line 7

Thanks in Advance,
Raghavendra S: eek:
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Oct 2002
Location: Baghdad, Iraq
Posts: 697
Can you break this down to the smallest code that reproduces the error? I'm guessing that it happens in the assignment $Excel=, but if not I'd have no idea. When you run the script, use:

perl -MCarp=verbose -w spaceusage_excel_pools2.pl

Also, are you sure this is the code that actually produces the error? The error message says eval { ... } called, but there is no such block.
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Aug 2012
Posts: 1
Hi,

I am also getting the same error. eval{...} block error is for Const.pm module and not for the main script.

main::BEGIN() called at E:/Perl/lib/Win32/OLE/Const.pm line 8
eval {...} called at E:/Perl/lib/Win32/OLE/Const.pm line 8

If any solution, please suggest.

Following error I am getting -
___________________________________________
No type library matching "Microsoft Excel" found at E:/Perl/lib/Win32/OLE/Const.
pm line 74
Win32::OLE::Const::LoadRegTypeLib('Win32::OLE::Con st', 'Microsoft Excel'
, undef, undef, undef, undef) called at E:/Perl/lib/Win32/OLE/Const.pm line 47
Win32::OLE::Const::Load('Win32::OLE::Const', 'Microsoft Excel', undef, u
ndef, undef, undef, 'main') called at E:/Perl/lib/Win32/OLE/Const.pm line 29
Win32::OLE::Const::import('Win32::OLE::Const', 'Microsoft Excel') called
at ReadExcelSheet.pl line 8
main::BEGIN() called at E:/Perl/lib/Win32/OLE/Const.pm line 8
eval {...} called at E:/Perl/lib/Win32/OLE/Const.pm line 8
Win32::OLE(0.1709): GetOleTypeLibObject() Not a Win32::OLE::TypeLib object at E:
/Perl/lib/Win32/OLE/Const.pm line 49.
Bareword "xlPrevious" not allowed while "strict subs" in use at ReadExcelSheet.p
l line 34.
Bareword "xlByRows" not allowed while "strict subs" in use at ReadExcelSheet.pl
line 34.
Execution of ReadExcelSheet.pl aborted due to compilation errors.
______________________________________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On