Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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 12-24-07, 06:24
RAGHAVENDRA S RAGHAVENDRA S is offline
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 01-03-08, 00:31
sco08y sco08y is offline
Registered User
 
Join Date: Oct 2002
Location: Fort Polk, LA
Posts: 500
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
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

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